s=eval(input())

n=len(s)

dp=[[0,0] for i in range(n)]

dp[0][0]=1

for i in range(1,n):

    dp[i][0]=dp[i-1][1]+1

    if s[i-1]!=s[i]:

        dp[i][0]=max(dp[i][0],dp[i-1][0]+1)

    if i>1:

        dp[i][1]=dp[i-2][0]+1

        if i>2:

            if s[i-3:i-1]!=s[i-1:i+1]:

                dp[i][1]=max(dp[i][1],dp[i-2][1]+1)

print((max(dp[n-1])))
s=eval(input())

ans=1

l=len(s)

now=s[0]

i=1

while i<l:

    if now!=s[i]:

        now=s[i]

        ans+=1

        i+=1

    else:

        if len(now)==2:

            now=s[i]

            ans+=1

            i+=1

        else:

            if i<l-1:

                now=s[i:i+2]

                i+=2

                ans+=1

            else:

                break

    #print(i)

print(ans)

s = eval(input())
n = len(s)
dp = [[0, 0] for i in range(n)]
dp[0][0] = 1
for i in range(1, n):
    dp[i][0] = dp[i - 1][1] + 1
    if s[i - 1] != s[i]:
        dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1)
    if i > 1:
        dp[i][1] = dp[i - 2][0] + 1
        if i > 2:
            if s[i - 3 : i - 1] != s[i - 1 : i + 1]:
                dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1)
print((max(dp[n - 1])))

s = eval(input())
ans = 1
l = len(s)
now = s[0]
i = 1
while i < l:
    if now != s[i]:
        now = s[i]
        ans += 1
        i += 1
    else:
        if len(now) == 2:
            now = s[i]
            ans += 1
            i += 1
        else:
            if i < l - 1:
                now = s[i : i + 2]
                i += 2
                ans += 1
            else:
                break
    # print(i)
print(ans)

-n = len(s) -dp = [[0, 0] for i in range(n)] -dp[0][0] = 1 -for i in range(1, n): -    dp[i][0] = dp[i - 1][1] + 1 -    if s[i - 1] != s[i]: -        dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1) -    if i > 1: -        dp[i][1] = dp[i - 2][0] + 1 -        if i > 2: -            if s[i - 3 : i - 1] != s[i - 1 : i + 1]: -                dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1) -print((max(dp[n - 1]))) +ans = 1 +l = len(s) +now = s[0] +i = 1 +while i < l: +    if now != s[i]: +        now = s[i] +        ans += 1 +        i += 1 +    else: +        if len(now) == 2: +            now = s[i] +            ans += 1 +            i += 1 +        else: +            if i < l - 1: +                now = s[i : i + 2] +                i += 2 +                ans += 1 +            else: +                break +    # print(i) +print(ans)