import numpy as np
from collections import defaultdict

#key = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

#A, B, K = map(int, input().split())  #
S = input()
S_list = list()
for i in range(len(S)):
    S_list.append(S[i])
#print(len(S_list))

flag = True
cnt = 0
while flag:
    flag = False
    k = 0
    #print(S_list)
    for i in range(len(S_list)-1):
        #print(i+1)
        if S_list[i - k] != S_list[i+1 - k]:
            #print(i, i+1)
            S_list.pop(i-k)
            S_list.pop(i-k)
            cnt += 2
            flag = True
            k += 2
            #break
        pass
    pass
print(cnt)