S = input()
S_array = []

for i in S:
    S_array.append(i)
    
answer = 0
i = 0
idx = []

while (0 <= i and i <= len(S_array) -2):
    if S_array[i] != S_array[i+1]:
        del S_array[i:i+2]
        i -= 1
        answer += 2
    else:
        i += 1
        
print(answer)