#include <iostream>
using namespace std;

int main() {
  string s;
  cin >> s;
  int ans = s.length();
  int i = 1;
  while (i < s.length()) {
    if (s[i - 1] == s[i]) {
      i += 3;
      ans--;
    } else {
      i += 1;
    }
  }
  cout << ans << endl;
  return 0;
}

