#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s += '*';
  int n = s.length();
  int res = 0;
  int cnt = 0;
  int lim = 0;
  for (int i = 0; i < n - 1; i++) {
    if (lim == 0) {
      res++;
      lim ^= 1;
    } else {
      cnt++;
      if (cnt == 2) {
        cnt = 0;
        res++;
        lim ^= 1;
      } else if (s[i] != s[i - 1] && s[i] != s[i + 1]) {
        res++;
        cnt = 0;
      }
    }
  }
  cout << res;
  return 0;
}
