#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int c = 0, p = 0, pc = 1, ppc = 0, n = s.size();
  for (; p + pc <= n;) {
    if (pc == 2) {
      p += 2;
      c++;
      ppc = pc;
      pc = 1;
    } else {
      c++;
      ppc = pc;
      if (s[p] == s[p + 1])
        pc = 2;
      else
        pc = 1;
      p += 1;
    }
  }
  if (ppc == 1 && pc == 1 && s[n - 1] == s[n - 2]) c--;
  cout << c << endl;
}
