import re
s = input()
first_len = len(s)
ans = 0

while True:
    s = s.replace("01","").replace("10","")
    if not re.search('01|10',s):
        break

# print(len(s),first_len - len(s),s)
print(first_len - len(s))