#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;
  int prepresize = 0, presize = 1;
  string prepre, pre = "";
  pre += S[0];
  for (int i = 1; i < N; i++) {
    if (now != 1) {
      count++;
      if (count > 2 && prepresize == 1 && prepre[0] == S[i - 2]) {
        prepre = pre;
        prepresize = presize;
        pre = S[i];
        prepresize = 1;
        now = 1;
      } else {
        now = 2;
        pre = "";
        pre += S[i - 1];
        pre += S[i];
        presize = 2;
        prepre = S[i - 2];
        prepresize = 1;
      }
    } else if (S[i] != S[i - 1]) {
      count++;
      prepresize = presize;
      prepre = pre;
      pre = S[i];
      presize = 1;
    } else {
      now = 2;
      pre = "";
      pre += S[i - 1];
      pre += S[i];
      presize = 2;
    }
  }
  std::cout << count << '\n';
  return 0;
}
