S = eval(input())

t = S[0]

ans = 0

for k in range(1,len(S)):

    if t != S[k]:

        ans += 1

        t = S[k]

print(ans)

S = eval(input())

ans = 0

for k in range(1,len(S)):

    if S[k-1] != S[k]:

        ans += 1

print(ans)

S = eval(input())
t = S[0]
ans = 0
for k in range(1, len(S)):
    if t != S[k]:
        ans += 1
        t = S[k]
print(ans)

S = eval(input())
ans = 0
for k in range(1, len(S)):
    if S[k - 1] != S[k]:
        ans += 1
print(ans)

-t = S[0] -    if t != S[k]: +    if S[k - 1] != S[k]: -        t = S[k]