fork download
  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #define ll long long
  4. #define MOD 1e9+7
  5. using namespace std;
  6.  
  7. int main(){
  8. string str;
  9. cin>>str;
  10. ll max_length = 0;
  11. ll i = 0;
  12. while(i<str.size()){
  13. ll j = i ;
  14. while(j<str.size() && str[i]==str[j])j++;
  15. max_length = max(max_length,(ll)j-i);
  16. i = j;
  17. }
  18. cout<<max_length<<endl;
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
0