str=list(input())


cnt=len(str)

buf=[]

for i in range(1,len(str)):
    if str[i] == str[i-1]:
        cnt-=1
        buf.append(str[i]+str[i])
        i+=1

        
flag=0    
for j in range(3,len(str)):
    if flag<=0:
        if str[j-3]==str[j-2] and str[j-1]==str[j]:
            cnt+=1
            flag=4
        continue
    else:
        flag-=1
        
print(cnt)
    