Advertisement
ivangarvanliev

Untitled

Jun 3rd, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7.     string s;
  8.     cin >> s;
  9.     int n = s.length(), best = 0, curr = 1;
  10.     for (int i = 1; i < n; i++)
  11.     {
  12.         if (s[i] != s[i - 1])
  13.         {
  14.             best = max(best, curr);
  15.             curr = 0;
  16.         }
  17.         curr++;
  18.     }
  19.     best = max(best, curr);
  20.     cout << best;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement