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