s = input()

if(len(s) <= 2):
    print(len(set(list(s))))
    exit()
dp = [0 for _ in range(len(s))]
dp[0] = 1
for i in range(1,len(s)):
    if(s[i] != s[i-1]):dp[i] = dp[i-1] + 1
    else:
        if(i >= 3):dp[i] = dp[i-3] + 2
        else:dp[i] = dp[i-1]
print(dp[-1])