str = list(input())
last = str[0]
check = 0
ans = 0
while True:
    check = 0
    last = str[0]
    for j in range(len(str) - 1):
        if last != str[j + 1]:
            str.pop(j)
            str.pop(j)
            check = 1
            ans += 2
            break
        last = str[j+1]
    if check == 0:
        break
    if str == []:
        break

print(ans)
