#include <bits/stdc++.h>
int main(void) {
  char S[200000];
  scanf("%s", S);
  int S_size = strlen(S);
  int ans = S_size, i;
  char castle[10];
  sprintf(castle, "%c", S[0]);
  char kate[10];
  int flag = 0;
  for (i = 1; i < S_size; i++) {
    sprintf(kate, "%c", S[i]);
    if (strcmp(castle, kate) == 0 && flag == 0 && i != S_size - 1) {
      ans--;
      flag = 2;
    } else if (strcmp(castle, kate) == 0 && flag != 0) {
      flag = 0;
      sprintf(castle, "%c", S[i]);
    } else {
      sprintf(castle, "%s", kate);
      if (flag != 0) flag--;
    }
  }
  printf("%d\n", ans);
  return 0;
}
