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