#include <bits/stdc++.h>
using namespace std;
int FindDivideMaxNum(const string &s, vector<int> *divideLens) {
  assert(divideLens);
  int sum = accumulate(divideLens->begin(), divideLens->end(), 0);
  int length = s.length();
  if (length == sum) {
    return 1;
  }
  if (0) {
    if (sum > 0) {
      for (auto i : *divideLens) {
        cout << i << ", ";
      }
      cout << endl;
    }
  }
  string s_prev = "";
  if (divideLens->size() > 0) {
    int prev = *(divideLens->end() - 1);
    if (0) {
      cout << "preview num: ";
      cout << prev << endl;
    }
    s_prev = s.substr(sum - prev, prev);
  }
  int ret = 0;
  for (int i = 1; i < 3; i++) {
    if (length - sum < i) break;
    if (0) {
      cout << "s_sub: " << s.substr(sum, i) << endl;
    }
    if (s_prev == s.substr(sum, i)) continue;
    divideLens->push_back(i);
    ret = FindDivideMaxNum(s, divideLens);
    if (ret) {
      break;
    } else {
      divideLens->pop_back();
    }
  }
  return ret;
}
int main() {
  string s;
  cin >> s;
  assert(s.length() > 0 && s.length() < 200001);
  if (0) cout << "s: " << s << endl;
  vector<int> v;
  FindDivideMaxNum(s, &v);
  cout << v.size() << endl;
  return 0;
}
