from itertools import*;print((len(list(groupby(eval(input()))))-1))
print((sum(map(input().count,["WB","BW"]))))
from itertools import *

print((len(list(groupby(eval(input())))) - 1))

print((sum(map(input().count, ["WB", "BW"]))))

-from itertools import * - -print((len(list(groupby(eval(input())))) - 1)) +print((sum(map(input().count, ["WB", "BW"]))))