#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  cin >> S;
  int org = S.size();
  if (S.size() == 1) {
    cout << 0 << endl;
  } else {
    while (true) {
      int t = -1;
      for (int i = 0; i < S.size() - 1; i++) {
        if (S[i] != S[i + 1]) {
          t = i;
          break;
        }
      }
      if (t == -1) {
        break;
      }
      S.erase(t, 1);
      if (S.size() == 1) {
        break;
      }
    }
    cout << (org - S.size()) << endl;
  }
}
