s = list(input())
count = 0
l = []
while (True):
    old = count
    if (len(s) == 1 or len(s) == 0):
        break
    for n in range(len(s) - 1):
        if (s[n] != s[n+1]):
            s.pop(n)
            s.pop(n)
            count += 2
            n -= 1
        if (len(s) <= n + 2):
            break
    if (old == count):
        break
print(count)