#include <bits/stdc++.h>
using namespace std;
template <typename qwq>
inline void read(qwq& x) {
  x = 0;
  register int f = 1;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  x *= f;
}
template <typename qaq>
inline void print(qaq x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int cnt = 1, ans, flag;
char last;
int tmp[233333];
char s[233333];
int main() {
  scanf("%s", s + 1);
  register int len = strlen(s + 1);
  register int tmplen = 1;
  for (register int i = 1; i <= len; ++i) {
    if (s[i] == s[i + 1]) {
      if (tmplen == 1) {
        if (i == len - 2) {
          ++ans;
          break;
        }
        ++ans;
        ++tmplen;
      } else {
        ++i, ++ans;
        tmplen = 1;
      }
    } else {
      if (tmplen == 1)
        ++ans;
      else
        ++ans, tmplen = 1, ++i;
    }
  }
  print(ans);
  return 0;
}
