#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 1; i < S.size() - 1; i++) {
    if (S[i] == S[i - 1] || S[i] == S[i + 1]) cnt++;
  }
  cout << S.size() - cnt / 2 << endl;
}
