#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int f, l, c, e = 0;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] != s[i - 1]) {
      f = i - 1;
      c = 1;
      while (s[i] != s[i - 1]) {
        c++;
        i++;
        if (i > s.length()) break;
      }
      s.erase(f, c);
      e++;
      i = 0;
    }
  }
  cout << e << endl;
}
