S = list(eval(input()))

now = S[0]

ans = 0

for c in S[1:]:

    if c != now:

        ans += 1

        now = c

print(ans)

S = eval(input())

print((S.count("BW") + S.count("WB")))

S = list(eval(input()))
now = S[0]
ans = 0
for c in S[1:]:
    if c != now:
        ans += 1
        now = c
print(ans)

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

-S = list(eval(input())) -now = S[0] -ans = 0 -for c in S[1:]: -    if c != now: -        ans += 1 -        now = c -print(ans) +S = eval(input()) +print((S.count("BW") + S.count("WB")))