#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int MAX = 1e9;
int MOD = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  int n = s.size(), ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] != s[i + 1]) ans++;
  }
  cout << ans << endl;
}
