S=input()
N=len(S)

if N==1:
    print(1)
elif N==2:
    print(1 if S[0]==S[1] else 2)
else:
    
    K1=[0 for i in range(N)];S1=[None for i in range(N)]
    K2=[0 for i in range(N)];S2=[None for i in range(N)]
    
    K1[0]=1;S1[0]=S[0]
    K2[0]=0;S2[0]=None
    
    K1[1]=0 if S[0]==S[1] else 2;S1[1]=None if S[0]==S[1] else S[1]
    K2[1]=1;S2[1]=S[0:2]
    
    K1[2]=K2[1]+1 if S1[1]==S[2] else max(K1[0]+1,K2[1]+1)
    S1[2]=S[2]
    K2[2]=K1[0]+1
    S2[2]=S[1:3]

    if N==3:
        print(max(K1[2],K2[2]))
    else:
        for i in range(3,N):
            K1[i]=K2[i-1]+1 if S1[i-1]==S[i] else max(K1[i-1]+1,K2[i-1]+1)
            S1[i]=None if S1[i-1]==S[i] else S[i]
            K2[i]=K1[i-2]+1 if S2[i-2]==S[i-1:i+1] else max(K1[i-2]+1,K2[i-2]+1)
            S2[i]=None if S2[i-2]==S[i-1:i+1] else S[i-1:i+1]
        print(max(K1[N-1],K2[N-1]))