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