s = input()
k = 0

def f(s):
  s += '0'
  res = 0
  ex = ''
  for i in range(len(s)):
    c = s[i]
    if c == ex:
      ex = ex+c
    else:
      res += 1
      ex = c
  return res


print(max(f(s), f(s[::-1])))