s=input()

l=0

r=len(s)-1



news=""

i=0

while i<len(s):

    if s[i]=="W":

        while i<len(s) and s[i]=="W":

            i+=1

        news+=s[i-1]

    else:

        while i<len(s) and s[i]=="B":

            i+=1

        news+=s[i-1]

print((len(news)-1))
s=input()

now=s[0]

ans=0

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

    if now!=s[i]:

        ans+=1

        now=s[i]

print(ans)

s = input()
l = 0
r = len(s) - 1
news = ""
i = 0
while i < len(s):
    if s[i] == "W":
        while i < len(s) and s[i] == "W":
            i += 1
        news += s[i - 1]
    else:
        while i < len(s) and s[i] == "B":
            i += 1
        news += s[i - 1]
print((len(news) - 1))

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

-l = 0 -r = len(s) - 1 -news = "" -i = 0 -while i < len(s): -    if s[i] == "W": -        while i < len(s) and s[i] == "W": -            i += 1 -        news += s[i - 1] -    else: -        while i < len(s) and s[i] == "B": -            i += 1 -        news += s[i - 1] -print((len(news) - 1)) +now = s[0] +ans = 0 +for i in range(1, len(s)): +    if now != s[i]: +        ans += 1 +        now = s[i] +print(ans)