import re
S = str(input().split())
n = len(S)
count = 0
while(True):
    l_ = len(S)
    S = re.sub('01', '', S)
    S = re.sub('10', '', S)
    l = len(S)
    if l == l_:
        break
print(n-len(S))