#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << setprecision(15);
  char s[2000000];
  scanf("%s", s);
  int ans = 0;
  const int n = strlen(s);
  for (int length = 1; length < n; ++length) {
    if (n - length <= ans) break;
    int prev_length = length;
    int count = 1;
    for (int j = length; j < n;) {
      if (prev_length == 1 && s[j] == s[j - 1]) {
        if (j > n - 2) break;
        j += 2;
        prev_length = 2;
        count++;
        continue;
      }
      prev_length = 1;
      j++;
      count++;
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
  return 0;
}
