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