S = input()
S_len = len(S)
count = 1
point = 0
if S_len > 2:
  for i in range(0,S_len-1):
    if S[i] != S [i+1]:
      count=count + 1
      point=1     
    same_char_num  = S_len - count - 1
    if S[i] == S [i+1] and S[i+2] != S [i+3] and point==i-2:
      count=count+1
      point=2
print(count)