Ankit_132

B

Jul 22nd, 2023
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     int n, m;
  12.     cin>>n>>m;
  13.  
  14.     vector<string> s(n);
  15.     for(auto &e: s)
  16.       cin>>e;
  17.  
  18.     string t = "";
  19.  
  20.     for(int j=0; j<m; j++)
  21.     {
  22.         int f = 1;
  23.  
  24.         for(int i=0; i<n; i++)
  25.             f &= (s[i][j] == 'o');
  26.  
  27.         if(f)       t += 'o';
  28.         else        t += 'x';
  29.     }
  30.  
  31.     int ans = 0;
  32.     int val = 0;
  33.  
  34.     for(auto e: t)
  35.     {
  36.         if(e == 'o')        val++;
  37.         else                val = 0;
  38.  
  39.         ans = max(ans, val);
  40.     }
  41.  
  42.     cout<<ans<<"\n";
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment