#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  string pre = "$";
  int n = s.size();
  int ans = 0;
  for (int _ = (int)(0); _ < (int)(4); ++_) {
    int cnt = 0;
    for (int j = (int)(0); j < (int)(n); ++j) {
      string t = "";
      t += s[j];
      while (t == pre && j + 1 < n) {
        ++j;
        t += s[j];
      }
      ++cnt;
      if (pre == t) cnt = -1;
      pre = t;
    }
    pre = s[0];
    ans = max(ans, cnt);
    if (_ == 1) {
      reverse(s.begin(), s.end());
      pre = "$";
    }
  }
  cout << ans << endl;
  return 0;
}
