#include <bits/stdc++.h>
using namespace std;
string S;
int check(string first) {
  int ret = 1;
  string tmp = first;
  for (int i = first.length(); i < S.length(); i++) {
    if (tmp == S.substr(i, 1)) {
      if (i == S.length() - 1) {
        ret = -1;
      } else {
        tmp = S.substr(i, 2);
        i++;
        ret++;
      }
    } else {
      tmp = S.substr(i, 1);
      ret++;
    }
  }
  return ret;
}
int main() {
  cin >> S;
  int N = S.length();
  int ans1 = check(S.substr(0, 1));
  int ans2 = -1;
  if (S.length() > 1) {
    ans2 = check(S.substr(0, 2));
  }
  cout << max(ans1, ans2) << endl;
  return 0;
}
