s = input()

n = len(s)

dp = [0]*n

if n == 1:
    print(1)
    exit()
if n == 2:
    if s[0] == s[1]:
        print(1)
    else:
        print(2)
    exit()

# 1文字目
dp[0] = 1
# 2文字目
if s[0] == s[1]:
    dp[1] = 1 # aa -> a, a
else:
    dp[1] == 2 #  ab -> a, b
# 3文字目
if s[0] != s[1] and s[1] != s[2]: # a,b,c
    dp[2] = 3 # aba -> a, b, a
else:
    dp[2] = 2 #  ?aa -> ?a, a
# 4文字目～
for i in range(3,n):
    if s[i-1] == s[i]:
        dp[i] = dp[i-3]+2 # ??aa -> ?, ?a, a or ?, ?, aa
    else:
        dp[i] = dp[i-1]+1 # ?ab -> ?, a, b or ?a, b
print(dp[n-1])