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