from collections import deque
 
S = input()
 
ss = []
flag = True
ans = 0
for i in range(len(S)): ss.append(S[i])
 
while flag:
    length = len(ss)
    tmp_flag = False
    for i in range(length-1):
        if ss[i] != ss[i+1]:
            rm = i
            ans += 2
            tmp_flag = True
            break
    if tmp_flag:
        ss.pop(rm)
        ss.pop(rm)
    else:
        flag = False
    
print(ans)
