#include <bits/stdc++.h>
int main() {
  char(*s) = (char(*))malloc(100010 * sizeof(char));
  char top;
  long long i = 0;
  long long equal = 0;
  long long len;
  long long ans = 0;
  scanf("%s", s);
  top = s[0];
  len = strlen(s);
  while (i < len) {
    if (s[i] == top)
      equal++;
    else {
      if (equal == 1) {
        ans += 1;
        equal = 0;
        top = s[i];
        i--;
      }
      if (equal == 2) {
        ans += 2;
        equal = 0;
        top = s[i + 1];
      }
    }
    if (equal == 3) {
      ans += 2;
      equal = 0;
      top = s[i + 1];
    }
    i++;
  }
  if (equal == 1)
    ans += 1;
  else if (equal == 2)
    ans += 1;
  printf("%lld\n", ans);
  free(s);
  return 0;
}
