before=input()
cnt=0
flg=0
while len(before)>1:
    after=before.replace('10','')
    after=after.replace('01','')
    sa=len(before)-len(after)
    if sa==0:
        break
    else:
        cnt+=sa
        before=after
print(cnt)