s=eval(input())

count=1

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

    if s[i]=="B":

        if s[i+1]=="W":

            count+=1

    elif s[i]=="W":

        if s[i+1]=="B":

            count+=1

print((count-1))
s=list(eval(input()))

count=0

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

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

        count+=1

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

s = list(eval(input()))
count = 0
for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        count += 1
print(count)

-s = eval(input()) -count = 1 +s = list(eval(input())) +count = 0 -    if s[i] == "B": -        if s[i + 1] == "W": -            count += 1 -    elif s[i] == "W": -        if s[i + 1] == "B": -            count += 1 -print((count - 1)) +    if s[i] != s[i + 1]: +        count += 1 +print(count)