#include <bits/stdc++.h>
using namespace std;
int main() {
  const char* text;
  string a;
  cin >> a;
  text = a.c_str();
  int length = strlen(text);
  int count = length;
  int i = 2;
  while (i <= length - 1) {
    if (text[i - 1] == text[i])
      count--;
    else if (text[i - 1] == text[i - 2])
      count--;
    i += 3;
  }
  int lease = i - length;
  if (lease == 1)
    if (text[length - 1] == text[length - 2]) count--;
  cout << count;
  return 0;
}
