import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
void main()
{
	string S = readln.chomp;
    long n;
    char prev = '#';
    foreach(c;S)
    {
        if(c != prev)
        {
            prev = c;
            n++;
        }
    }
    writeln(n-1);
}