#include <bits/stdc++.h>
using namespace std;
char c;
string s;
int cnt = 0;
int main() {
  cin >> s;
  c = s[0];
  for (int i = 1; s[i]; i++) {
    if (c != s[i]) {
      c = s[i];
      cnt++;
    }
  }
  printf("%d", cnt);
  return 0;
}
