S = input()
dp = [-1, -1]*len(S)


def solve(s):
    l = len(s)
    if dp[l-1] != -1:
        return dp[l-1]
    else:

        if l >= 2:
            dp[l-2] = solve(s[:-1])
        else:
            dp[0] = [1, 1]
            return dp[0]
        if s[-1] != s[-2]:
            if dp[l-2][1] == 2 and s[-2] == s[-3]:
                dp[l-1] = [dp[l-2][0] + 1, 2]
            else:
                dp[l-1] = [dp[l-2][0] + 1, 1]
        else:
            if dp[l-2][1] == 2:
                dp[l-1] = [dp[l-2][0] + 1, 1]
            else:
                dp[l-1] = [dp[l-2][0], 2]

        return dp[l-1]


ans = solve(S)
print(ans[0])
