def main():
    S = list(input())
    count = 0
    while True:
        start_count = count
        for i, val in enumerate(S):
            try:
                if S[i] != S[i+1]:
                    S.pop(i)
                    S.pop(i)
                    count += 2
            except IndexError:
                pass

        if start_count == count:
            break

    print(count)


if __name__ == "__main__":
    main()
