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