#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long cnt = 0, n = 0, sum = 1, ans = 1;
  string s;
  cin >> s;
  for (long long h = 1; h < s.size(); h++) {
    if (cnt == 1) {
      cnt = 0;
      sum++;
      continue;
    }
    if (s[h - 1] != s[h]) {
      sum++;
    } else if (h == s.size() - 1) {
      sum = 0;
    } else {
      cnt++;
      sum++;
      h++;
    }
  }
  cnt = 1;
  for (long long h = 2; h < s.size(); h++) {
    if (cnt == 1) {
      cnt = 0;
      ans++;
      continue;
    }
    if (s[h - 1] != s[h]) {
      ans++;
    } else if (h == s.size() - 1) {
      ans = 0;
    } else {
      cnt++;
      ans++;
      h++;
    }
  }
  cout << max(sum, ans) << endl;
  cin >> n;
  return 0;
}
