import sys sys.setrecursionlimit(10**6) N = list(input()) ans = 0 cnt = 0 N.reverse() n = len(N) memo = [[-1, -1] for i in range(n)] def dfs(i, b): if i == n: return b if memo[i][b] != -1: return memo[i][b] r = 10**6 if N[i] == '1': if b: r = min(r, dfs(i+1, 1)) else: r = min(r, min(dfs(i+1, 0), dfs(i+1, 1)) + 1) else: if b: r = min(r, min(dfs(i+1, 0), dfs(i+1, 1)) + 1) else: r = min(r, dfs(i+1, 0)) memo[i][b] = r return r print(dfs(0, 0))