#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  vector<string> kek;
  long long n = s.size();
  if (n == 1) {
    cout << 1;
    return 0;
  }
  string p = "";
  long long st = 1;
  if (s[0] == s[1]) {
    p += s[0];
    p += s[1];
    st = 2;
  } else {
    p += s[0];
  }
  kek.push_back(p);
  for (long long i = st; i < n; i++) {
    if (kek.back().size() == 2) {
      string w = "";
      w += s[i];
      kek.push_back(w);
    } else {
      if (s[i] == s[i - 1]) {
        if (i < n - 1 && kek.size() >= 2) {
          string w = "";
          w += s[i];
          w += s[i + 1];
          i++;
          kek.push_back(w);
        } else {
          kek.back() += s[i];
        }
      } else {
        string w = "";
        w += s[i];
        kek.push_back(w);
      }
    }
  }
  cout << kek.size();
  return 0;
}
