import sys
fin = sys.stdin.readline

import copy
ob = list(fin())
for i in range(len(ob)-1):
     if ob[i]=="0" and ob[i+1]=="1":
          ob[i]="1"
          ob[i+1]="0"
n = len(ob)
while True:
     ob_sub = copy.copy(ob)
     j=0
     for i in range(len(ob)-1):
          if ob[i]=="1" and ob[i+1]=="0":
               ob_sub[i],ob_sub[i+1] = "#","#"
               j+=2
     for i in range(j):
          ob_sub.remove("#")
     if ob_sub == ob:
          break
     else:
          ob = ob_sub
          
while True:
     ob_sub = copy.copy(ob)
     j=0
     for i in range(len(ob)-1):
          if ob[i]=="0" and ob[i+1]=="1":
               ob_sub[i],ob_sub[i+1] = "#","#"
               j+=2
     for i in range(j):
          ob_sub.remove("#")
     if ob_sub == ob:
          break
     else:
          ob = ob_sub

print(n-len(ob))