#include <bits/stdc++.h>
using namespace std;
int f(string s, string bef, int i) {
  int ret = 1;
  while (i < s.size()) {
    if (bef.size() % 2 == 0) {
      bef = s.at(i);
    } else {
      if (bef == string(1, s.at(i))) {
        if (i + 1 == s.size()) return -1;
        bef = string(1, s.at(i)) + string(1, s.at(i + 1));
        i++;
      } else {
        bef = s.at(i);
      }
    }
    i++;
    ret++;
  }
  return ret;
}
int main() {
  string s;
  cin >> s;
  int ret;
  if (s.size() == 1) {
    ret = 1;
  } else if (s.size() == 2 && s[0] == s[1]) {
    ret = 1;
  } else if (s.size() == 2 && s[0] != s[1]) {
    ret = 2;
  } else {
    ret = f(s, string(1, s.at(0)), 1);
    if (ret == -1) ret = f(s, string(1, s.at(0)) + string(1, s.at(1)), 2);
  }
  cout << ret << endl;
  return 0;
}
