S = eval(input())



cnt = 0

before = ""

for i in range(len(S)):

    if S[i] != before:

        cnt += 1

    before = S[i]

print((cnt-1))
S = eval(input())



print((S.count("BW") + S.count("WB")))
S = eval(input())
cnt = 0
before = ""
for i in range(len(S)):
    if S[i] != before:
        cnt += 1
    before = S[i]
print((cnt - 1))

S = eval(input())
print((S.count("BW") + S.count("WB")))

-cnt = 0 -before = "" -for i in range(len(S)): -    if S[i] != before: -        cnt += 1 -    before = S[i] -print((cnt - 1)) +print((S.count("BW") + S.count("WB")))