S = list(input())
count = 0

while True:
    change = False
    for i in range(len(S)-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            change = True
            count += 2
            break
    if not change:
        break

print(count)