s = list(input())
new_s = [s[0]]
i = 1
t = 0
if len(s)==1:
    print(1)
elif len(s)==2:
    if s[1]==s[0]:
        print(1)
    else:
        print(2)
else:
    while i <= len(s)-1:
        if s[i]!=new_s[t] :
            new_s.append(s[i])
            i +=1
            t +=1
        else:
            if len(s)-i==4:
                if s[i]==s[i+1]==s[i+2]==s[i+3]:
                    new_s.append(s[i]+s[i+1]+s[i+2])
                    new_s.append(s[i+3])
                    t+=2
                    break
                else:
                    s_2=s[-4:]
                    new_s.append(s_2[0])
                    t+=1
                    l=1
                    while l <=3:
                        if s_2[l]!=new_s[t] :
                            new_s.append(s_2[l])
                            t +=1
                            l+=1
                        else:
                            new_s.append(s_2[l]+s_2[l+1])
                            t+=1
                            l+=2
                            
                    new_s.append(s[i]+s[i+1])
                    i+=2
                    t+=1
            else:
                new_s.append(s[i]+s[i+1])
                i+=2
                t+=1
                
    print(len(new_s))