S = eval(input())

N = len(S)



ans = 0

pre = ""

now = ""



for i in range(N):

    if pre == now or now == "":

        now += S[i]

    if pre != now:

        ans += 1

        pre = now

        now = ""



print(ans)
S = eval(input())

N = len(S)



ans = 0

pre = ""

now = ""



for s in S:

    now += s

    if pre != now:

        ans += 1

        pre = now

        now = ""



print(ans)
S = eval(input())
N = len(S)
ans = 0
pre = ""
now = ""
for i in range(N):
    if pre == now or now == "":
        now += S[i]
    if pre != now:
        ans += 1
        pre = now
        now = ""
print(ans)

S = eval(input())
N = len(S)
ans = 0
pre = ""
now = ""
for s in S:
    now += s
    if pre != now:
        ans += 1
        pre = now
        now = ""
print(ans)

-for i in range(N): -    if pre == now or now == "": -        now += S[i] +for s in S: +    now += s