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