s = str(input())

s = [_ for _ in s]
for i in range(0, len(s)-1):
    if i+2 <= len(s)-1:
        if s[i] == s[i+1]:
            s[i+1] = s[i+1] + s.pop(i+2)
    
if s[-1] == s[-2]:
    print(len(s) - 1)
else:
    print(len(s))