S = str(input())
S_list = list(S)
N = len(S)

import sys
i = 0
count = 0
while len(S_list) > 1.5:
    try:
        #print("len(S_list) = ", len(S_list))
        if S_list[i] == S_list[i+1]:
            i +=1
            #print("Current i = ", i)
        else:
            S_list.pop(i)
            S_list.pop(i)
            #print("after pop len(S_list) = ", len(S_list))
            count+=2
            i=0
    except IndexError:
            print(count)
            sys.exit()
print(count)