import re



s = eval(input())



s = re.sub(r"([BW])\1*(?!\1)", r"\1", s)



print((int(len(s) - 1)))
S = eval(input())



prev = S[0]

cnt = 0

for s in S[1:]:

    if prev != s:

        cnt += 1

    prev = s



print(cnt)

import re

s = eval(input())
s = re.sub(r"([BW])\1*(?!\1)", r"\1", s)
print((int(len(s) - 1)))

S = eval(input())
prev = S[0]
cnt = 0
for s in S[1:]:
    if prev != s:
        cnt += 1
    prev = s
print(cnt)

-import re - -s = eval(input()) -s = re.sub(r"([BW])\1*(?!\1)", r"\1", s) -print((int(len(s) - 1))) +S = eval(input()) +prev = S[0] +cnt = 0 +for s in S[1:]: +    if prev != s: +        cnt += 1 +    prev = s +print(cnt)