S = input()
Sl = S[0]
f = True
now = 1
N = len(S)
count = 0
n = 0

for i in range(1, N):
  if S[i] == S[i-1]:
    now += 1
  else:
    f = False
    if now != 2:
      count += now // 2 + 1
      if n > 1:
        count += n+1
      elif n:
        count += 1
      n = 0
    else:
      n += 1
    now = 1
    
if now != 2:
  count += now // 2 + 1
else:
  if n >= 1:
    count += n+2
  else:
    count += 1

if f:
  if N > 2:
    print(N//2+1)
  else:
    print(1)

print(count)