S = eval(input())

N = len(S)





ans = sum([1 for i in range(N-1) if S[i]!=S[i+1]])

print(ans)
S = eval(input())





ans = S.count("WB") + S.count("BW")

print(ans)

S = eval(input())
N = len(S)
ans = sum([1 for i in range(N - 1) if S[i] != S[i + 1]])
print(ans)

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

-N = len(S) -ans = sum([1 for i in range(N - 1) if S[i] != S[i + 1]]) +ans = S.count("WB") + S.count("BW")