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