unittest
{
	assert( [ "BBBWW" ].parse.expand.solve == 1 );
	assert( [ "WWWWWW" ].parse.expand.solve == 0 );
	assert( [ "WBWBWBWBWB" ].parse.expand.solve == 9 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	return s.group.walkLength - 1;
}
