
S = list(input())
counter = 1
i = 0
n = len(S)
while((n-i-1)>0):
    tmp = S[n-i-1]
    if S[n-i-2] == tmp and (n-i-2)>0:
        if S[n-i-3] == tmp and (n-i-3)>0:
            if S[n-i-4] == tmp and (n-i-4)>0:
                if S[n-i-5] == tmp and (n-i-5)>0:
                    i += 5
                    counter += 3
                else:
                    i +=4
                    counter += 3
            else:
                i +=3
                counter +=2
        else:
            i += 2
            counter +=1
    else:
        i +=1
        counter += 1
print(counter)