s = eval(input())

ans = 0

while len(s):

    c = s[0]

    for i in range(len(s)):

        if s[i] != c:

            idx = i

            break

        idx2 = i

    if idx2 == len(s)-1:

        break

    s = s[idx:]

    ans += 1



print(ans)

s = eval(input())

ans = 0

c = s[0]

for i in range(len(s)):

    if s[i] != c:

        ans += 1

        c = s[i]

print(ans)

s = eval(input())
ans = 0
while len(s):
    c = s[0]
    for i in range(len(s)):
        if s[i] != c:
            idx = i
            break
        idx2 = i
    if idx2 == len(s) - 1:
        break
    s = s[idx:]
    ans += 1
print(ans)

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

-while len(s): -    c = s[0] -    for i in range(len(s)): -        if s[i] != c: -            idx = i -            break -        idx2 = i -    if idx2 == len(s) - 1: -        break -    s = s[idx:] -    ans += 1 +c = s[0] +for i in range(len(s)): +    if s[i] != c: +        ans += 1 +        c = s[i]