#include <bits/stdc++.h>
using namespace std;
char S[202020];
long long dp[202020];
long long i, j, ans;
int main() {
  scanf("%s", S);
  dp[0] = 1;
  dp[1] = -1e9;
  dp[2] = 2;
  for (i = 1; S[i]; i++) {
    long long a = dp[i - 1] + 1;
    if (S[i - 1] != S[i]) {
      dp[i] = max(dp[i], a);
    }
    a++;
    dp[i + 2] = max(dp[i + 2], a);
  }
  dp[i + 1]--;
  printf("%lld", max(dp[i], dp[i + 1]));
  return 0;
}
