#include <bits/stdc++.h>
int main(void) {
  char str[100000];
  char* str1 = (char*)str;
  char mem = 0;
  int ans = 0;
  scanf("%s", str);
  do {
    if (mem != *str1) ans++;
    mem = *str1;
  } while (*(++str1));
  printf("%d\n", ans - 1);
  return 0;
}
