#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int INF = 0x3f3f3f3f;
const int inf = -INF;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
int main() {
  std::ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int block = 0;
  for (int i = 1; i <= s.size() - 1; i++) {
    if (s[i] != s[i - 1]) block++;
  }
  cout << block << endl;
  return 0;
}
