#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long int LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
signed main() {
  string S;
  cin >> S;
  int n = S.size();
  vector<int> dp(n + 5);
  for (int i = 0; i < (int)(n + 1); i++) dp[i] = 0;
  dp[0] = 0;
  dp[1] = 1;
  bool flag = false;
  for (int i = 2; i <= n; i++) {
    if (S[i - 2] != S[i - 1] || flag) {
      if (dp[i] < dp[i - 1] + 1) {
        flag = false;
        dp[i] = dp[i - 1] + 1;
      }
    }
    if ((dp[i] <= dp[i - 2] + 1) &&
        (((S[i - 4] != S[i - 2]) && (S[i - 3] != S[i - 1])) || (i < 4))) {
      flag = true;
      dp[i] = dp[i - 2] + 1;
    }
  }
  cout << dp[n] << endl;
  return 0;
}
