S = list(input())
i = 0
cnt = 0

while True:
    if len(S) < 2:
        break
    if S[i] != S[i+1]:
        cnt += 2
        S.pop(i)
        S.pop(i)
        if i > 0:
            i -= 1
    else:
        i += 1
print(cnt)