#include <bits/stdc++.h>
int main(void) {
  int k = 0, l = 0, n, a = 1;
  char s[200000];
  scanf("%s", s);
  n = strlen(s);
  while (l < n) {
    if (s[l] != s[l + 1]) {
      if (l == n - 1) {
        l++;
        k++;
        break;
      }
      if (s[l + 1] != s[l + 2]) {
        k++;
        l++;
      } else {
        while (s[l + 1] == s[l + 2]) {
          l++;
          a++;
        }
        if (a % 2 == 1) {
          l++;
          k += ((a + 1) / 2);
        } else {
          l += 2;
          k += ((a + 2) / 2);
        }
      }
    } else {
      while (s[l] == s[l + 1]) {
        l++;
        a++;
      }
      if (a % 2 == 1) {
        l++;
        k += ((a + 1) / 2);
      } else {
        l += 2;
        k += ((a + 2) / 2);
      }
    }
    a = 1;
  }
  printf("%d\n", k);
  return 0;
}
