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