s = list(eval(input()))



if len(set(s)) == 1:

    print((0))

    exit()



ans = 0

tmp = s[0]

state = False

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

    if tmp == "B" and s[i] == "W":

        state = True

    elif tmp == "B" and s[i] == "B":

        if state:

            ans += 2

            state = False

            tmp = "B"

    if tmp == "W" and s[i] == "B":

        state = True

    elif tmp == "W" and s[i] == "W":

        if state:

            ans += 2

            state = False

            tmp = "W"



if state:

    ans += 1

print(ans)





s = list(eval(input()))



ans = 0

tmp = s[0]

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

    if tmp != s[i]:

        tmp = s[i]

        ans += 1



print(ans)











s = list(eval(input()))
if len(set(s)) == 1:
    print((0))
    exit()
ans = 0
tmp = s[0]
state = False
for i in range(1, len(s)):
    if tmp == "B" and s[i] == "W":
        state = True
    elif tmp == "B" and s[i] == "B":
        if state:
            ans += 2
            state = False
            tmp = "B"
    if tmp == "W" and s[i] == "B":
        state = True
    elif tmp == "W" and s[i] == "W":
        if state:
            ans += 2
            state = False
            tmp = "W"
if state:
    ans += 1
print(ans)

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

-if len(set(s)) == 1: -    print((0)) -    exit() -state = False -    if tmp == "B" and s[i] == "W": -        state = True -    elif tmp == "B" and s[i] == "B": -        if state: -            ans += 2 -            state = False -            tmp = "B" -    if tmp == "W" and s[i] == "B": -        state = True -    elif tmp == "W" and s[i] == "W": -        if state: -            ans += 2 -            state = False -            tmp = "W" -if state: -    ans += 1 +    if tmp != s[i]: +        tmp = s[i] +        ans += 1