#include <bits/stdc++.h>
using namespace std;
int split(const string& s, int prev, int cur, int count, int n) {
  if (cur >= n) return count;
  if (cur - prev == 1 && s[prev] == s[cur]) {
    if (cur > n - 2) return -1;
    return split(s, cur, cur + 2, count + 1, n);
  }
  return split(s, cur, cur + 1, count + 1, n);
}
int main() {
  cout << setprecision(15);
  string s;
  cin >> s;
  int ans = 0;
  const int n = s.size();
  for (int i = 1; i < n; ++i) {
    if (n - i <= ans) break;
    ans = max(ans, split(s, 0, i, 1, n));
  }
  cout << ans << endl;
  return 0;
}
