#include <bits/stdc++.h>
using namespace std;
map<int, string> CharMap;
void num2str() {
  CharMap[0] = "0";
  CharMap[1] = "1";
  CharMap[2] = "2";
  CharMap[3] = "3";
  CharMap[4] = "4";
  CharMap[5] = "5";
  CharMap[6] = "6";
  CharMap[7] = "7";
  CharMap[8] = "8";
  CharMap[9] = "9";
}
string to_string(long long n) {
  string s = "";
  while (n > 0) {
    int x = n % 10;
    n /= 10;
    s = CharMap[x] + s;
  }
  return s;
}
long long pow1(long long x, long long y) {
  if (y == 0) return 1;
  long long temp = pow1(x, y / 2) % 1000000007;
  if (y % 2 == 0)
    return (temp * temp) % 1000000007;
  else
    return (((temp * temp) % 1000000007) * x) % 1000000007;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  string s;
  int compo = 1, i = 0;
  num2str();
  cin >> s;
  char prev = s[0];
  for (i = 1; i < s.length();) {
    while (s[i] == prev && i < s.length()) {
      i++;
    }
    compo++;
    prev = s[i];
  }
  cout << compo - 2;
  printf("\n");
  return 0;
}
