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 j >= len(str):
            break

        if last != str[j + 1 - check]:
            str.pop(j-check)
            str.pop(j-check)
            check += 1
            ans += 2

        if str == []:
            break
        last = str[j + 1 - check]

    if check == 0:
        break
    if str == []:
        break

print(ans)
