# coding: utf-8
# Your code here!
S=list(input())

count=0
temp=[]
pre=[]
while len(S)>3:
    temp.append(S.pop(0))
    if temp==pre:
        temp.append(S.pop(0))
    pre.clear()
    pre+=temp
    temp.clear()
    count+=1
if pre[-1]==S[0] or S[0]==S[1] or S[1]==S[2]:
    print(count+2)
else:
    print(count+3)
#わからん