#c

S = input()

def clean(seq):
    if len(seq) == 1:
        return seq
    
    cleaned_seq = []
    remove_flag = False
    for idx, s in enumerate(seq):
        if remove_flag:
            remove_flag = False
            continue
            
        if idx == len(seq)-1:
            cleaned_seq.append(s)
            break

        this_ = int(s)
        next_ = int(seq[idx+1])
        if this_ + next_ == 1:
            remove_flag = True
        else:
            cleaned_seq.append(s)
            
    return cleaned_seq

former_cleaned = []
cleaned = S
while(not len(cleaned) == len(former_cleaned)):
    former_cleaned = cleaned
    cleaned = clean(former_cleaned)
    
print(len(S) - len(cleaned))
