s = input()
res = 0

x = [s[0]]

i = 1
while i < len(s):
  if s[i] != x[-1]:
    x.append(s[i])
    i += 1
  else:
    if i == len(s) - 1:
      x[-1] += s[i]
      i += 1
    else:
      x.append(s[i] + s[i + 1])
      i += 2

if len(x) >= 2 and x[-1] == x[-2]:
  x[-2] += x[-1]
  del x[-1]

print(len(x))
