#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7;
string yn(bool f) { return f ? "Yes" : "No"; }
string YN(bool f) { return f ? "YES" : "NO"; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string s, t, b;
  long long ans = 0, ans2 = 0;
  cin >> s;
  if (s.size() == 1) {
    cout << 1 << "\n";
    return 0;
  }
  for (long long i = 0; i < s.size(); i++) {
    t += s[i];
    if (t == b) {
    } else {
      b = t;
      t.clear();
      ans++;
    }
  }
  if (t.size()) ans--;
  t.clear();
  b.clear();
  b = s[0];
  b += s[1];
  ans2 = 1;
  for (long long i = 2; i < s.size(); i++) {
    t += s[i];
    if (t == b) {
    } else {
      b = t;
      t.clear();
      ans2++;
    }
  }
  if (t.size()) ans2--;
  cout << max(ans, ans2) << "\n";
  return 0;
}
