s = str(eval(input()))

n = len(s)



X = ['']

temp = ''

for i in range(n):

    temp += s[i]

    if temp == X[-1]:

        continue

    else:

        X.append(temp)

        temp = ''

else:

    if temp != '':

        if temp == X[-1]:

            X[-1] += temp

        else:

            X.append(temp)



#print(X)

print((len(X)-1))

s = str(eval(input()))



S = []

temp = ''

for c in s:

    temp += c

    if S:

        if S[-1] != temp:

            S.append(temp)

            temp = ''

    else:

        S.append(temp)

        temp = ''

print((len(S)))

s = str(eval(input()))
n = len(s)
X = [""]
temp = ""
for i in range(n):
    temp += s[i]
    if temp == X[-1]:
        continue
    else:
        X.append(temp)
        temp = ""
else:
    if temp != "":
        if temp == X[-1]:
            X[-1] += temp
        else:
            X.append(temp)
# print(X)
print((len(X) - 1))

s = str(eval(input()))
S = []
temp = ""
for c in s:
    temp += c
    if S:
        if S[-1] != temp:
            S.append(temp)
            temp = ""
    else:
        S.append(temp)
        temp = ""
print((len(S)))

-n = len(s) -X = [""] +S = [] -for i in range(n): -    temp += s[i] -    if temp == X[-1]: -        continue +for c in s: +    temp += c +    if S: +        if S[-1] != temp: +            S.append(temp) +            temp = "" -        X.append(temp) +        S.append(temp) -else: -    if temp != "": -        if temp == X[-1]: -            X[-1] += temp -        else: -            X.append(temp) -# print(X) -print((len(X) - 1)) +print((len(S)))