S = list(input())
ans = []
i = 0
while i < len(S)-1:
    if S[i] == S[i+1]:
        ans.append(S[i])
        ans.append("".join(S[i+1:i+3]))
        i += 3 
    else:
        ans.append(S[i])
        i += 1

if ans[-1] == S[-1]:
    ans[-1] = "".join(S[-2:])
    ans.pop(-2)
else:
    ans.append(S[-1])

print(len(ans))