S = eval(input())



count = 0

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

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

        count += 1



print(count)
S = eval(input())

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

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

-count = 0 -for i in range(len(S) - 1): -    if S[i] != S[i + 1]: -        count += 1 -print(count) +print((S.count("WB") + S.count("BW")))