s = input()
ans = 0
p = "1"
before = ""
for i in s:
  if(p != i):
    before = p
    p = i
    ans += 1
  elif(len(p) == 2 or p == "1"):
    p = i
    ans += 1
    flg = False
    if(len(before) == 2 and before != p and p != "1"):
      ans += 1
      flg = True
    before = p
    if(flg):
      before = i
  else:
    p += i


if(len(before) == 2 and before != p):
  ans += 1

print(ans)