#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
template <class T>
inline void chmax(T &a, const T &b) {
  if ((a) < (b)) (a) = (b);
}
template <class T>
inline void chmin(T &a, const T &b) {
  if ((a) > (b)) (a) = (b);
}
template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
  Fast() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
long long solve() {
  string s;
  cin >> s;
  long long n = ((long long)(s).size());
  vector<long long> dp1(n, -INF);
  vector<long long> dp2(n, -INF);
  dp1[0] = 1;
  dp2[0] = -INF;
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    if (i + 1 < n) {
      if (s[i + 1] != s[i]) chmax(dp1[i + 1], dp1[i] + 1);
      chmax(dp1[i + 1], dp2[i] + 1);
    }
    if (i + 2 < n) {
      chmax(dp2[i + 2], dp1[i] + 1);
      if (s[i - 1] != s[i + 1] || s[i] != s[i + 2])
        chmax(dp2[i + 2], dp2[i] + 1);
    }
  }
  42;
  42;
  cout << max(dp1[n - 1], dp2[n - 1]) << endl;
  return 0;
}
signed main() {
  solve();
  return 0;
}
