import sys

def divide(S, i, prv_S):
  tmp_S = ""
  for i in range(i,len(S)):
    tmp_S = tmp_S + S[i]
    if tmp_S != prv_S:
      return i+1, tmp_S
  return len(S)+1, None

S = sys.stdin.readline()
ans = 0
prv_S = None

# Sが一文字の時
if len(S) == 1:
  print(1)
  exit()

#S1を決める
if S[0] != S[1]:
  prv_S = S[0]
  index_S = 1
else:
  prv_S = S[:2]
  index_S = 2
ans += 1
#S2以降を決める
while index_S < len(S):
  index_S, prv_S = divide(S, index_S, prv_S)
  ans += 1
print(ans)