#c

S = input()

def clean(seq):
#     print("seq: ", seq)
    if len(seq) == 1:
        return seq
    
    def get_removee_left(cand_seq):
        if len(cand_seq) == 1:
            return -1
        for idx, s in enumerate(cand_seq[:-1]):
            if int(s) + int(cand_seq[idx+1]) == 1:
                return idx
        return -1
        
    ans = seq
    
    left = get_removee_left(seq)
#     print("left: ",left)
    if left > 0:
#         print("give:",seq[:left]+seq[left+2:])
        give = seq[:left]+seq[left+2:]
        ans = clean(give)
    elif left == 0:
#         print("give:", seq[left+2:])
        ans = clean(seq[left+2:])
    else:
        pass
        
    return ans
    
    
#     cleaned_seq = []
#     remove_flag = False
#     for idx, s in enumerate(seq):
#         if remove_flag:
#             ans = clean(clean_seq)
            
#         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))
print(len(S) - len(clean(S)))
