s = eval(input())

cnt = 0

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

    if s[i] == 'W' and s[i + 1] == 'B':

        cnt += 1

    if s[i] == 'B' and s[i + 1] == 'W':

        cnt += 1

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



tmp = S[0]

cnt = 0

for s in S[1:]:

    if tmp != s:

        cnt += 1

        tmp = s

        

print(cnt)
s = eval(input())
cnt = 0
for i in range(len(s) - 1):
    if s[i] == "W" and s[i + 1] == "B":
        cnt += 1
    if s[i] == "B" and s[i + 1] == "W":
        cnt += 1
print(cnt)

S = eval(input())
tmp = S[0]
cnt = 0
for s in S[1:]:
    if tmp != s:
        cnt += 1
        tmp = s
print(cnt)

-s = eval(input()) +S = eval(input()) +tmp = S[0] -for i in range(len(s) - 1): -    if s[i] == "W" and s[i + 1] == "B": +for s in S[1:]: +    if tmp != s: -    if s[i] == "B" and s[i + 1] == "W": -        cnt += 1 +        tmp = s