class Compress: def __init__(self,array): """ A=[(a,degeneracy),...] """ S=[0] self.array=array[:] self.A=[] for a, cnt in array: S.append(S[-1]+cnt) self.A.append(a) self.S=S[1:] def __getitem__(self, i): j=bisect_left(self.S,i+1) return self.A[j] def sum(self, i): """ sum in [0,i) """ j=bisect_left(self.S,i) res=0 q=0 for k in range(j): res+=self.A[k]*(self.S[k]-q) q=self.S[k] print(j, res) if j>0: res+=self.A[j]*(i-self.S[j-1]) else: res+=self.A[j]*(i) return res def sort(self): S=[0] self.A=[] for a, cnt in sorted(self.array): S.append(S[-1]+cnt) self.A.append(a) self.S=S[1:] def __iter__(self): l=0 for i in range(self.S[-1]): if i==self.S[l]: l+=1 yield self.A[l] def __str__(self): return " ".join(list(map(str, self))) def deg(A): """ 連続して続く文字を圧縮する(※Counterではない) [1,1,1,2,2,2,3] -> [(1,3),(2,3),(3,1)] """ res=[] a0, cnt=A[0], 1 for a in A[1:]+[None]: if a!=a0: res.append((a0,cnt)); cnt=1 else: cnt+=1 a0=a return res def bit_rep(bit,N): return format(bit, "0" + str(N) + "b") def bits_rep(bits,N): return [format(bit, "0" + str(N) + "b") for bit in bits] ############################################################### import sys from bisect import * input = sys.stdin.readline N=input().rstrip() S=list(map(int,N)) data=deg(S) res=0 for i in range(len(data)): a,cnt=data[i] if a==0:continue if i!=0 and data[i-1][1]==1: res+=min(1,cnt) else: res+=min(2,cnt) print(res)