#include <bits/stdc++.h>
using namespace std;
int main() {
  string word;
  int length, poz = -1, numberOfStrings = 0, weHaveAStringWith3 = 0, jumpOver;
  cin >> word;
  length = word.length() - 1;
  while (poz <= length - 1) {
    poz++;
    if (word[poz] != word[poz + 1]) {
      numberOfStrings++;
    } else {
      numberOfStrings++;
      if (weHaveAStringWith3 == 0) {
        weHaveAStringWith3 = 1;
        poz++;
      } else {
        weHaveAStringWith3 = 0;
      }
      continue;
      jumpOver = 0;
      numberOfStrings--;
    }
    if (jumpOver == 1) {
      weHaveAStringWith3 = 0;
    }
  }
  cout << numberOfStrings;
  return 0;
}
