cses

My solution for the coding challenges of cses.fi
git clone https://git.tronto.net/cses
Download | Log | Files | Refs | README

repetitions_1069.cpp (298B)


      1 #include <algorithm>
      2 #include <iostream>
      3 #include <string>
      4 
      5 int main() {
      6 	char cur{'x'};
      7 	int n{0}, m{0};
      8 	std::string str;
      9 	std::cin >> str;
     10 	for (auto c : str) {
     11 		if (c == cur) {
     12 			n++;
     13 		} else {
     14 			m = std::max(m, n);
     15 			n = 1;
     16 			cur = c;
     17 		}
     18 	}
     19 	std::cout << std::max(m, n) << std::endl;
     20 }