#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, ans = 0;
  string s;
  cin >> s;
  l = s.length();
  ans = l;
  for (int i = 0; i < l - 1; i++) {
    if (s[i] == s[i + 1]) {
      ans--;
      if (i != l - 2 && s[i] == s[i + 2]) {
        i++;
      }
    }
  }
  if (s[l - 1] == s[l - 2]) ans++;
  cout << ans << endl;
  return 0;
}
