S = list(input())
ans = 0
for _ in range(len(S)):
    check = S[0]
    tmp = ans
    for i in range(1,len(S)):
        if check != S[i]:
            ans += 2
            del S[i-1:i+1]
            break
        check = S[i]
    if len(S) == 0:
        break
    if tmp == ans:
        break
print(ans)