s = input()
lst = []

if len(s) == 1:
    print(1)
    exit()

q = 0
while q <= len(s)-2:
    if s[q] == s[q+1]:
        lst.append(s[q])
        if q+1 != len(s)-1:
            lst.append(s[q+1:q+3])
        q += 3
    else:
        lst.append(s[q])
        q += 1
else:
    ans = len(lst)
    text = str(lst).replace('[','').replace(']','').replace(',','').replace("'",'').replace(" ",'')
    if text != s:
        ans += 1
print(ans)