S = input()

s_list=[]
for i in range(len(S)):
    s_list.append(S[i])

num=0
judge=1
N=len(s_list)
while judge==1:
    judge=0
    for i in range(N):
        if i+1 < len(s_list):
            if s_list[i] != s_list[i+1]:
                #print(i,len(s_list),s_list,s_list[i],s_list[i+1])
                del s_list[i:i+2]
                num+=2
                judge=1
        else:
            break
    N = len(s_list)
print(num)