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