Skip to content

Commit ca29f08

Browse files
committed
Solved problem 1025C from codeforces
1 parent cad8fe3 commit ca29f08

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
string s;
6+
7+
int main() {
8+
cin >> s;
9+
s += s;
10+
11+
int res = 0;
12+
for(int i = 0; i < s.length(); ++i) {
13+
int cur = 1;
14+
while(i + 1 < s.length() && s[i] != s[i + 1] && cur < s.length() / 2)
15+
++cur, ++i;
16+
res = max(res, cur);
17+
}
18+
19+
printf("%d\n", res);
20+
21+
return 0;
22+
}

CodeForces/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@
556556
- [1023D. Array Restoration](http://codeforces.com/contest/1023/problem/D)
557557
- [1025A. Doggo Recoloring](http://codeforces.com/contest/1025/problem/A)
558558
- [1025B. Weakened Common Divisor](http://codeforces.com/contest/1025/problem/B)
559+
- [1025C. Plasticine zebra](http://codeforces.com/contest/1025/problem/C)
559560
- [1027A. Palindromic Twist](http://codeforces.com/contest/1027/problem/A)
560561
- [1027B. Numbers on the Chessboard](http://codeforces.com/contest/1027/problem/B)
561562
- [1027C. Minimum Value Rectangle](http://codeforces.com/contest/1027/problem/C)

0 commit comments

Comments
 (0)