s=eval(input())

c=s[0]

ans=0

for cn in s:

    if cn!=c:

        c=cn

        ans+=1

print(ans)
s=eval(input())

print((s.count('WB')+s.count('BW')))
s = eval(input())
c = s[0]
ans = 0
for cn in s:
    if cn != c:
        c = cn
        ans += 1
print(ans)

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

-c = s[0] -ans = 0 -for cn in s: -    if cn != c: -        c = cn -        ans += 1 -print(ans) +print((s.count("WB") + s.count("BW")))