n=list(map(int,list(input()))) n2=n[::-1]+[0] n3=[] # print(n,n2) count=0 for i in range(len(n2)-1): if n2[i]==2: n2[i]=0 n2[i+1]+=1 elif n2[i]==1 and n2[i+1]==1: n2[i],n2[i+1]=0,2 count+=1 else:pass for i in n2: if i==1: count+=1 print(count)