s = input()

N = len(s)
a = []
a.append(s[0])

i = 1
j = 1
while i < N-1:
    pre = a[j-1]
    tmp = s[i]
    if pre == s[i]:
        tmp += s[i+1]
        i += 1
    a.append(tmp)
    i += 1
    j += 1
a.append(s[-1])

ans = len(a)
if a[-1] == a[-2]:
    ans -= 1
if a[-1] == a[-2] and a[-3] == a[-2]+a[-1]:
    ans -= 1
print(ans)