import sys def main(): def input(): return sys.stdin.readline()[:-1] N = input() ans = 0 L = list(N.split("00")) if len(L) > 1: for l in range(len(L)-1): for k in range(len(L[l])): e = L[l] if e[k] == "1": ans += min(e[k:].count("1"),e[k:].count("0")+2) break e = L[-1] for k in range(len(e)): if e[k] == "1": e = e[k:] break e = e[::-1] for k in range(len(e)): if e[k] == "1": e = e[k:] break ans += min(e[k:].count("1"),e[k:].count("0")+2) else: for e in L: for k in range(len(e)): if e[k] == "1": ans += min(e[k:].count("1"),e[k:].count("0")+2) break print(ans) if __name__ == '__main__': main()