#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  long long answer = 0, i;
  cin >> S;
  for (i = 0; i < (long long)S.length() - 3; i++) {
    if (S[i] != S[i + 1]) {
      answer++;
    } else {
      answer += 2;
      i += 2;
    }
  }
  if (i == (long long)S.length() - 1) {
    answer++;
  } else {
    if (S[i] != S[i + 1]) {
      if (S[i + 1] != S[i + 2]) {
        answer += 3;
      } else {
        answer += 2;
      }
    } else {
      answer += 2;
    }
  }
  cout << answer;
  return 0;
}
