#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, st;
  cin >> s;
  st += s[0];
  int l = s.size(), count = 0;
  for (int i = 1; i < l; i++) {
    if (s[i - 1] == s[i] && (st.size() > 1 || i == 1)) {
      st += s[i];
    } else {
      count++;
      st = s[i];
    }
  }
  cout << count;
}
