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