#include <bits/stdc++.h>
char S[200001] = {0};
int main() {
  int ans = 0;
  int len = 0, i = 0;
  scanf("%s", S);
  len = strlen(S);
  while (i < len) {
    if (S[i] == S[i + 1]) {
      i += 3;
      if (len < i) {
      } else {
        ans++;
      }
    } else {
      i++;
      if (len <= i) {
      } else {
        if (S[i] == S[i + 1]) {
          i += 2;
          ans++;
        }
      }
    }
    ans++;
  }
  printf("%d\n", ans);
  return 0;
}
