#include <bits/stdc++.h>
using namespace std;
void solve(std::string S) {
  long long N = S.size();
  vector<long long> dp(N);
  dp[0] = 1;
  for (long long i = 1; i < N; i++) {
    if (i - 3 < 0) {
      dp[i] = max(dp[i - 1], dp[i - 1] + ((S[i] != S[i - 1]) ? 1 : 0));
      continue;
    }
    dp[i] = (S[i] != S[i - 1]) ? (dp[i - 1] + 1) : (dp[i - 3] + 2);
  }
  cout << dp[N - 1] << endl;
}
int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}
