fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios_base::sync_with_stdio(false); cin.tie(NULL);
  6. string s;
  7. cin >> s;
  8. int ans = 1, i = 0;
  9. while(i < s.length()-1) {
  10. int cnt = 1;
  11. while(s[i] == s[i+1]) {
  12. cnt++;
  13. i++;
  14. }
  15. ans = max(ans,cnt);
  16. i++;
  17. }
  18. cout << ans;
  19. return 0;
  20. }
Success #stdin #stdout 0s 5428KB
stdin
ATTCGGGA
stdout
3