fork download
  1. /*
  2. * @Author: hungeazy
  3. * @Date: 2026-03-04 23:24:15
  4. * @Last Modified by: hungeazy
  5. * @Last Modified time: 2026-03-11 23:45:42
  6. */
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. string s;
  10.  
  11. int main()
  12. {
  13. ios_base::sync_with_stdio(false);
  14. cin.tie(NULL); cout.tie(NULL);
  15. cin >> s;
  16. int n = s.size(), cnt = 0, ans = 0;
  17. char x = '#';
  18. for (int i = 0; i < n; i++)
  19. if (x != s[i])
  20. {
  21. ans = max(ans,cnt);
  22. cnt = 1;
  23. x = s[i];
  24. }
  25. else if (x == s[i]) cnt++;
  26. ans = max(ans,cnt);
  27. cout << ans;
  28. return 0;
  29. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty