#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string S;
  int count = 0;
  std::cin >> S;
  int N = S.size();
  std::vector<long long int> dp(N, 0);
  dp[0] = 1;
  int now = 1;
  count = 1;
  for (int i = 1; i < N; i++) {
    if (now != 1 || S[i] != S[i - 1]) {
      count++;
      if (now == 2 && i >= 3 && S[i - 2] == S[i - 3])
        now = 1;
      else if (now == 1)
        now = 1;
      else
        now = 2;
    } else {
      now = 2;
    }
  }
  std::cout << count << '\n';
  return 0;
}
