S=list(input())
n=len(S)

for m in range(n):
 condition=0
 for i in range(len(S)-1):
   if S[i]==S[i+1]:
     condition=1
     if i==len(S)-2:
       c=S[i]+S[i+1]
       del S[i:i+2]
       S.insert(i,c)
     elif S[i+1] != S[i+2]:
       c=S[i+1]+S[i+2]
       del S[i+1:i+3]
       S.insert(i+1,c)      
     else:
       #c=S[i]+S[i+1]
       del S[i:i+1]
       #S.insert(i,c)
     break
 if condition==0:
 #  print(S)
   print(len(S))
   break
    
    
