s = input()
l = len(s)

def df(s):
  idx = [i for i, v in enumerate(list(s)) if v == '0']
  c = []

  if len(idx) == 0:
    c.append(len(s))
  else:
    for i in idx:
      if i < len(s) - 1:
        if s[i + 1] == '1':
          c.append(df(s[:i] + s[i + 2:]))
        elif i > 1:
          if s[i - 1] == '0':
            c.append(df(s[:i - 2] + s[i:]))
        else:
          c.append(len(s))
      else:
        c.append(len(s))
  return min(c)

print(l - df(s))