N = list(input()) ans = 0 i = len(N) - 1 while i < len(N): if N[i] == "1": j = i while j >= 0 and N[j] == "1": j +- 1 ans += 1 if i - j == 1: i = j - 1 else: if j == -1: ans += 1 break else: N[j] = "1" i = j else: i -= 1 print(ans)