s = input()

n = len(s)

if n <= 2:
    print(n)
    exit()

g = [0] * n
g[0] = 1
if s[0] == s[1]:
    g[1] = 1
    g[2] = 2
elif s[1] == s[2]:
    g[1] = 2
    g[2] = 2

for i in range(3, n):
    if s[i] == s[i-1]:
        g[i] = g[i-3] + 2
    else:
        g[i] = g[i-1] + 1

print(g[-1])