Created
July 20, 2020 10:22
-
-
Save vipul43/554133d86ef8876924bee430b6bc7311 to your computer and use it in GitHub Desktop.
cses day1 problems solutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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