Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- string s;
- cin >> s;
- int n = s.length(), best = 0, curr = 1;
- for (int i = 1; i < n; i++)
- {
- if (s[i] != s[i - 1])
- {
- best = max(best, curr);
- curr = 0;
- }
- curr++;
- }
- best = max(best, curr);
- cout << best;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement