def main():

    S = eval(input())

    n = len(S)

    dp = [0 for _ in range(n+1)]

    dp[0] = 0

    dp[1] = 1

    for i in range(1, n):

        if i == 1:

            if S[i-1] == S[i]: dp[i+1] = 1

            else: dp[i+1] = 2

        else:

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

                dp[i+1] = dp[i] + 1

            else:

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

    return dp[n]



if __name__ == '__main__':

    print((main()))
def main():



    S = eval(input())

    ref = S[0]

    i = 1

    ans = 1

    while i < len(S):

        if S[i] == ref:

            if i < len(S)-1:

                ref = S[i:i+2]

                ans += 1

                i += 2

            else:

                i += 1

        else:

            ref = S[i]

            ans += 1

            i += 1

    return ans





if __name__ == '__main__':

    print((main()))

def main():
    S = eval(input())
    n = len(S)
    dp = [0 for _ in range(n + 1)]
    dp[0] = 0
    dp[1] = 1
    for i in range(1, n):
        if i == 1:
            if S[i - 1] == S[i]:
                dp[i + 1] = 1
            else:
                dp[i + 1] = 2
        else:
            if S[i] != S[i - 1]:
                dp[i + 1] = dp[i] + 1
            else:
                dp[i + 1] = dp[i - 2] + 2
    return dp[n]


if __name__ == "__main__":
    print((main()))

def main():
    S = eval(input())
    ref = S[0]
    i = 1
    ans = 1
    while i < len(S):
        if S[i] == ref:
            if i < len(S) - 1:
                ref = S[i : i + 2]
                ans += 1
                i += 2
            else:
                i += 1
        else:
            ref = S[i]
            ans += 1
            i += 1
    return ans


if __name__ == "__main__":
    print((main()))

-    n = len(S) -    dp = [0 for _ in range(n + 1)] -    dp[0] = 0 -    dp[1] = 1 -    for i in range(1, n): -        if i == 1: -            if S[i - 1] == S[i]: -                dp[i + 1] = 1 +    ref = S[0] +    i = 1 +    ans = 1 +    while i < len(S): +        if S[i] == ref: +            if i < len(S) - 1: +                ref = S[i : i + 2] +                ans += 1 +                i += 2 -                dp[i + 1] = 2 +                i += 1 -            if S[i] != S[i - 1]: -                dp[i + 1] = dp[i] + 1 -            else: -                dp[i + 1] = dp[i - 2] + 2 -    return dp[n] +            ref = S[i] +            ans += 1 +            i += 1 +    return ans