Files
cses/CSES - CSES Problem Set/Introducotry_Problems/Repetitions.cpp
2024-06-03 16:57:59 +02:00

26 lines
506 B
C++

// Repetitions
#include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int max_count = 0;
int current_count = 0;
char current = ' ';
for (auto c : s) {
if (c == current) {
current_count ++;
max_count = max(max_count, current_count);
} else {
current = c;
current_count = 1;
max_count = max(max_count, current_count);
}
}
cout << max_count << endl;
return 0;
}