first 7 Introductory problems
This commit is contained in:
25
CSES - CSES Problem Set/Repetitions.cpp
Normal file
25
CSES - CSES Problem Set/Repetitions.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user