Skip to content

Instantly share code, notes, and snippets.

@vipul43
Created July 20, 2020 10:22
Show Gist options
  • Save vipul43/554133d86ef8876924bee430b6bc7311 to your computer and use it in GitHub Desktop.
Save vipul43/554133d86ef8876924bee430b6bc7311 to your computer and use it in GitHub Desktop.
cses day1 problems solutions
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
void solution(){
string s;
cin >> s;
int count = 1;
int max_count = 0;
for(int i=0; i<s.length()-1; i++){
if(s[i]==s[i+1]){
count++;
} else{
max_count = max(max_count, count);
count = 1;
}
}
max_count = max(max_count, count);
cout << max_count << endl;
}
int main() {
int T=1;
// cin >> T;
for(int t=0; t<T; t++) {
solution();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment