S = eval(input())

X = S[0]

ans = 0

while 1:    

    for i in range(len(S)):

        if S[i] != X:

            ans += 1

            X =S[i]

            S = S[i:]

            break

    else:

        break

print(ans)

    

S = eval(input())

l = len(S)

ans = sum(a != b for a,b in zip(S[:l-1],S[1:]))

print(ans)
S = eval(input())
X = S[0]
ans = 0
while 1:
    for i in range(len(S)):
        if S[i] != X:
            ans += 1
            X = S[i]
            S = S[i:]
            break
    else:
        break
print(ans)

S = eval(input())
l = len(S)
ans = sum(a != b for a, b in zip(S[: l - 1], S[1:]))
print(ans)

-X = S[0] -ans = 0 -while 1: -    for i in range(len(S)): -        if S[i] != X: -            ans += 1 -            X = S[i] -            S = S[i:] -            break -    else: -        break +l = len(S) +ans = sum(a != b for a, b in zip(S[: l - 1], S[1:]))