#include <bits/stdc++.h>
using namespace std;
bool cmpf(pair<long long, long long> left, pair<long long, long long> right) {
  return left.first < right.first;
}
int main() {
  string s, t, temp, comp;
  cin >> s;
  t = s;
  int num1 = 0, num2 = 0;
  temp += s[0];
  s.erase(s.begin());
  while (!s.empty()) {
    comp += s[0];
    s.erase(s.begin());
    if (comp != temp) {
      temp = comp;
      num1++;
      comp.erase(comp.begin(), comp.end());
    }
  }
  if (comp == temp) num1 == 0;
  comp.erase(comp.begin(), comp.end());
  temp.erase(temp.begin(), temp.end());
  temp += t[0] + t[1];
  t.erase(t.begin(), t.begin() + 1);
  while (!t.empty()) {
    comp += t[0];
    t.erase(t.begin());
    if (comp != temp) {
      temp = comp;
      num2++;
      comp.erase(comp.begin(), comp.end());
    }
  }
  if (comp == temp) num2 == 0;
  cout << (num1 > num2 ? num1 : num2);
}
