S = input()
S_array = []

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

if len(S_array) < 2:
    print(0)
else:
    while True:
        a = 0
        for i in range(2,len(S_array)):
            if S_array[i] != S_array[i-1]:
                del S_array[i-1:i+1]
                a += 1
                answer += 2
                break
        if a == 0:
            break
    print(answer)