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
    if i < S_len - 2:
      if S[i] == S[i+1] and S[i+2] == S[i+3] and point!=i-2:
        count=count+1
        point=i
print(count)