s=str(eval(input()))

ans=0

for i in range(len(s)-1):

  if s[i]!=s[i+1]:

    ans+=1

print(ans)



s=eval(input())

a=s.count('BW')

b=s.count('WB')



print((a+b))
s = str(eval(input()))
ans = 0
for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        ans += 1
print(ans)

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

-s = str(eval(input())) -ans = 0 -for i in range(len(s) - 1): -    if s[i] != s[i + 1]: -        ans += 1 -print(ans) +s = eval(input()) +a = s.count("BW") +b = s.count("WB") +print((a + b))