S = input()
Sl = S[0]
count = 1
N = len(S)
f = False
ff = True

for i in range(1, N):
  if S[i] != S[i-1]:
    ff = False
    
  if f:
    f = False
    count += 1
  elif S[i] == Sl and i < N-1:
    f = True
    Sl = S[i]+S[i+1]
  else:
    count += 1
    Sl = S[i]
    
if ff:
  if N > 2:
    print(N//2+1)
  else:
    print(1)
elif N > 1 and S[N-2] == S[N-1]:
  print(count - 1)
else:
  print(count)