s = input()
count = 0
flag = True
while flag == True:
    flag = False
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            s = s[0:i]+s[i+2:]
            count += 2
            flag = True
            break

print(count)