#include <bits/stdc++.h>
const int MN = 100005;
const int Inf = 0x3f3f3f3f;
int N;
char s[MN];
int f[MN], g[MN];
int main() {
  scanf("%s", s + 1), N = strlen(s + 1);
  f[0] = g[0] = g[1] = -Inf;
  f[1] = 1;
  for (int i = 2; i <= N; ++i) {
    f[i] = g[i - 1] + 1, g[i] = f[i - 2] + 1;
    if (f[i - 1] > 0 && s[i - 1] != s[i]) f[i] = std::max(f[i], f[i - 1] + 1);
    if (g[i - 2] > 0 && (s[i - 3] != s[i - 1] || s[i - 2] != s[i]))
      g[i] = std::max(g[i], g[i - 2] + 1);
  }
  printf("%d\n", std::max(f[N], g[N]));
  return 0;
}
