def solve(S):
    ans = 0
    i = 0
    j = 1
    taken = [1 for _ in S]
    while j < len(S):
        if S[i] != S[j]:
            taken[i] = 0
            taken[j] = 0
            ans += 2

            j += 1
            while taken[i] == 0:
                i -= 1
                if i == -1:
                    i = j
                    j = j + 1
                if j >= len(S):
                    break
        else:
            i += 1
            j += 1

    return ans

if __name__ == "__main__":
    S = input()
    print(solve(S))
