import numpy as np

s = input()
s = np.asarray(list(s))
ans = 0
i = 0
while True:
    if s[i] != s[i+1]:
        s = np.delete(s, [i, i+1])
        ans = ans + 2
        i = i - 1
        if i != -1:
            i = i - 1
    i = i+1
    if len(s) == 0 or len(s) == i+1:
        break
print(ans)