S = input()
s = [i for i in S]

#最後の処理でバグってる
ans = [[s[0]]]
s.remove(s[0])
while len(s)>0:
  temp = [s[0]]
  s.remove(s[0])
  if temp==ans[-1] and len(s)>0:
    temp.append(s[0])
    s.remove(s[0])
    ans.append(temp)
  elif temp==ans[-1] and len(s)==0:
    ans[-1] = [temp[0], temp[0]]
    while len(ans)>=2 and ans[-1]==ans[-2]:
      last_list = ans[-2]+ans[-1]
      ans.remove(ans[-1])
      ans.remove(ans[-1])
      ans.append(last_list)
  else:
    ans.append(temp)

print(len(ans))