def calc(num):
  num += 1
  if num <= 2:
    return 1
  else:
    return num // 2 + 1

txt = input()
total = 0
renzoku = 0
for i in range(len(txt) - 1):
  #print(txt[i], txt[i + 1])
  if txt[i] != txt[i + 1]:
    if renzoku == 0:
      total += 1
    else:
      total += calc(renzoku)
    renzoku = 0
  else:
    #print(i, "renozku")
    renzoku += 1
if renzoku != 0:
  total += calc(renzoku)
else:
  total += 1
print(total)