import sys

def divide(S, i, prv_S):
  if i+1<len(S) and S[i+1] != prv_S:
    return i+1, S[i+1]
  elif i+2<len(S) and S[i+1:i+3] != prv_S:
    return i+2, S[i+1:i+3]
  else:
    return len(S)+1, None

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

ans_list = []
for i in range(0,2):
  prv_S = S[:i+1]
  index_S = i
  ans = 1
  #print(i, ans, index_S, prv_S)
  #S2以降を決める
  while index_S < len(S)-1:
    index_S, prv_S = divide(S, index_S, prv_S)
    ans += 1
    #print(i, ans, index_S, prv_S, len(S))
  if index_S == len(S)-1:
    ans_list.append(ans)
print(max(ans_list))