s = list(input())
count = 0
find = False
while True:
    if len(s) <=2:
        break
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            count += 2
            del s[i]
            del s[i+1]
            break
    else:
        break
    
print(count)