summaryrefslogtreecommitdiff
path: root/introductory_problems/repetitions.cpp
blob: ab90db9401d085a6750b4b0d51d4e92050be8d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 1069. Repetitions
#include <bits/stdc++.h>
using namespace std;

const int max_size = 1e6 + 5;

int main() {
  char str[max_size];
  scanf(" %s", str);
  int num = strlen(str), curr = 1, cnt = 1;
  for (int i = 1; i < num; i++) {
    curr = str[i] == str[i - 1] ? curr + 1 : 1;
    cnt = max(cnt, curr);
  }
  printf("%d\n", cnt);
}