cses

solution to cses exercise problems
git clone git://git.superpozycja.net/cses
Log | Files | Refs | README

repetitions.cpp (320B)


      1 #include <bits/stdc++.h>
      2 
      3 using namespace std;
      4 
      5 void solve()
      6 {
      7 	int res = 1;
      8 	string l;
      9 
     10 	while (getline(cin, l)) {
     11 		int s = 1;
     12 
     13 		for (int i = 0; i < l.length()-1; i++) {
     14 			if (l[i] == l[i+1]) {
     15 				s++;
     16 			} else {
     17 				s = 1;
     18 			}
     19 			res = res > s ? res : s;
     20 		}
     21 	}
     22 	cout << res << "\n";
     23 }
     24 
     25 int main()
     26 {
     27 	solve();
     28 }