import std.functional,
       std.algorithm,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  string s = readln.chomp;
  int c;

  foreach (i; 0..s.length-1) {
    if (s[i] != s[i + 1]) {
      c++;
    }
  }

  writeln(c);
}
