#include <bits/stdc++.h>
using namespace std;
char s[200005];
int dp[200005][2];
int main() {
  int i, j;
  scanf("%s", &s);
  int n = strlen(s);
  if (n == 1) {
    printf("1\n");
    return 0;
  }
  dp[0][0] = 1;
  dp[1][1] = 1;
  if (s[0] != s[1]) dp[1][0] = 1;
  for (i = 2; i < n; i++) {
    dp[i][0] = dp[i - 1][1] + 1;
    if (s[i] != s[i - 1]) dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
    dp[i][1] = dp[i - 2][0] + 1;
    if (s[i] != s[i - 2] || s[i - 1] != s[i - 3])
      dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1);
  }
  printf("%d", max(dp[n - 1][0], dp[n - 1][1]));
  return 0;
}
