#include <bits/stdc++.h>
using namespace std;
char a[200002];
int ans;
int f[200002][3];
int main() {
  scanf("%s", a + 1);
  int n = strlen(a + 1), t = 2;
  f[1][1] = 1;
  f[1][2] = 1;
  for (int i = 3; i <= n; i++) {
    if (a[i] != a[i - 1]) f[i][1] = max(f[i - 1][1] + 1, f[i][1]);
    f[i][1] = max(f[i - 2][2] + 1, f[i][1]);
    if (a[i] != a[i - 2] || a[i - 1] != a[i + 1])
      f[i][2] = max(f[i - 1][1] + 1, f[i - 2][2] + 1);
  }
  printf("%d", max(f[n][1], f[n][2]));
}
