s = input()
s = list(s)
count = 0
#for j in range(100):
while(1):
    length = len(s)
    for i in range(len(s)):
        try:
            if s[i] != s[i+1]:
                s.pop(i)
                s.pop(i)
                count = count+1
        except IndexError:
            pass
    if length == len(s):
        break
    
print(count*2)
