#include <bits/stdc++.h>
using namespace std;
int lenCount(string s, char c, int n) {
  int count = 2;
  for (int i = n + 2; i < s.length(); i++) {
    if (s[i] == c) count++;
  }
  return count;
}
int main() {
  string S;
  cin >> S;
  char tempc = S[0];
  int count = 0;
  for (int i = 0; i < S.length() - 1; i++) {
    if (tempc != S[i + 1]) {
      tempc = S[i + 1];
      count++;
    } else {
      int lencount = lenCount(S, S[i], i);
      if (lencount < 4 || lencount % 2 == 1) {
        tempc = '0';
      } else {
        count++;
      }
    }
  }
  if (S.length() > 1 && (S[S.length() - 1] == S[S.length() - 2])) count++;
  cout << count << endl;
  return 0;
}
