import sys

strings = str(input())
strings_list = []
for s in strings:
    strings_list.append(s)



flag = 1
num = 0
while flag == 1:
    flag = 0
    for i in range(len(strings_list) - 1):
        if strings_list[i] != strings_list[i + 1]:
            del strings_list[i+1]
            del strings_list[i]
            num += 2
            flag = 1
            break

print(num)
