#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<vector<string>> s(2);
  s[0].push_back(S.substr(0, 1)), s[1].push_back(S.substr(0, 2));
  for (int i = 0; i < 2; ++i) {
    unsigned j = i + 1;
    while (j < S.size())
      if (S.substr(j, 1) != s[i].back())
        s[i].push_back(S.substr(j, 1)), ++j;
      else if (S.size() - j >= 2)
        s[i].push_back(S.substr(j, 2)), j += 2;
      else {
        s[i].clear();
        break;
      }
  }
  cout << max(s[0].size(), s[1].size()) << endl;
}
