S = input()
ans = 0
i = 0
n = len(S)
while i < n:
    c1 = S[i]
    if i == n-1:
        ans += 1
        break
    c2 = S[i+1]
    if c1 == c2:
        i += 1
    ans += 1
    i += 1

if n > 2 and S[-1] == S[-2] and S[-2] != S[-3]: ans += 1
print(ans)