#include <bits/stdc++.h>
using namespace std;
int main() {
  long long counter;
  counter = 0;
  string S;
  cin >> S;
  int N;
  N = S.size();
  char a = S.at(0);
  for (int i = 0; i < N - 2; i++) {
    if (S.at(i + 1) == S.at(i + 2)) {
      counter++;
      i++;
    } else if (S.at(i) == S.at(i + 1)) {
      i += 2;
      counter += 2;
    } else
      counter++;
  }
  if (S.at(N - 1) == S.at(N - 2))
    counter++;
  else if (S.at(N - 3) == S.at(N - 2)) {
    a = '0';
  } else
    counter += 2;
  cout << counter << endl;
}
