#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  vector<int> dp1(N + 10), dp2(N + 10);
  dp1[1] = 1;
  dp2[2] = 1;
  for (int i = (int)(0); i < (int)(N); i++) {
    if (i >= 1) {
      if (S[i] != S[i - 1]) {
        dp1[i + 1] = max(dp1[i + 1], dp1[i] + 1);
        dp2[i + 2] = max(dp2[i + 2], dp1[i] + 1);
      }
    }
    if (i >= 2) {
      dp1[i + 1] = max(dp1[i + 1], dp2[i] + 1);
      if (S[i] != S[i - 2] || S[i + 1] != S[i - 1]) {
        dp2[i + 2] = max(dp2[i + 2], dp2[i] + 1);
      }
    }
  }
  cout << max(dp1[N], dp2[N]) << endl;
}
