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