-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepetitions.cpp
More file actions
45 lines (37 loc) · 797 Bytes
/
Copy pathRepetitions.cpp
File metadata and controls
45 lines (37 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <bits/stdc++.h>
#define ll long long
#define ln "\n"
#define fastio ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define mod 1e9 + 7
#define rep(i, n) for (long long i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;
using namespace std;
void solve()
{
int n;
string s;
cin>>s;
n = s.length();
s += 'x';
int cnt=1, ans=-1;
for(int i=0; i<=n; i++){
if(s[i]==s[i+1]){
cnt++;
}
else{
ans = max(ans, cnt);
cnt=1;
}
}
cout << ans;
}
int32_t main()
{
fastio;
int t=1;
// cin>>t;
while (t--)
solve();
return 0;
}