#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i <= s.length() - 2; i++) {
    char a = s[i];
    char b = s[i + 1];
    if (a != b) {
      ans++;
    }
  }
  cout << ans;
}
