s = list(input())
if len(s) == 1:
    print(1)
    exit()
elif len(s) == 2:
    if s[0] == s[1]:
        print(1)
    else:
        print(2)
    exit()
else:
    dp = [0]*len(s)
    dp[0] = 1
    if s[0]==s[1]:
        dp[1]=dp[0]
    else:
        dp[1]=dp[0]+1
    if s[1]==s[2]:
        dp[2]=dp[1]
    else:
        dp[2]=dp[1]+1

for i in range(3, len(s)):
    if s[i] != s[i-1]:
        dp[i] += dp[i-1]+1
    else:
        dp[i] += dp[i-3]+2

print(dp[-1])