s = input()
sl = list(s[i] for i in range(len(s)))


cnt = 0
 
for i in range(len(s)-2):
    if sl[i] == sl[i+1]:
        sl[i+2] = "0"
        cnt += 1
if s[-3] != "0" and s[-2] == s[-1]:
    cnt += 1
 
print(len(s) - cnt)