s=[*input()] while s and s[-1]=='1': s.pop() ans=z=0 while s: while s and s[-1]=='0': s.pop() z+=1 while s and s[-2:]==[*'11']: ans+=z s.pop();s.pop() while s and s[-1]=='1': z=0 s.pop() print(ans)