1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include <bits/stdc++.h> #define int long long #define IOS ios::sync_with_stdio(0),cin.tie(0) using namespace std; signed main(){ IOS; string s;cin>>s; int len = s.size(); int ans = 1,cur = 1; for(int i = 1;i < len;i++){ if(s[i] == s[i-1])cur++; else cur = 1; ans = max(ans,cur); } cout<<ans<<"\n"; }
|