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