S = str(input())
x = len(S)
if S[0] == '1':
    while '10' in S:
        S = S.replace('10', '')
    S = S.replace('01', '')
else:
    while '01' in S:
        S = S.replace('01', '')
    S = S.replace('10', '')

print(x - len(S))