#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  string t = "";
  vector<string> ans;
  for (int i = 0; i < s.size(); i++) {
    t += s[i];
    if (i % 3 == 2) {
      if (t[0] != t[1] && t[1] != t[2]) {
        ans.push_back(t.substr(0, 1));
        ans.push_back(t.substr(1, 1));
        ans.push_back(t.substr(2, 1));
      } else {
        if (ans.empty() || ans[ans.size() - 1] != t.substr(0, 1)) {
          ans.push_back(t.substr(0, 1));
          ans.push_back(t.substr(1));
        } else {
          ans.push_back(t.substr(0, 2));
          ans.push_back(t.substr(2));
        }
      }
      t = "";
    }
  }
  cout << ans.size();
  return 0;
}
