import sys
def check(S, cnt):
    stop = True
    if len(S) < 2:
        print(cnt)
        sys.exit()
    for i in range(len(S) - 1):
        if S[i] != S[i + 1]:
            S = S[:i] + S[i + 2:]
            cnt += 2
            check(S, cnt)
    print(cnt)
    sys.exit()

S = list(map(int, list(input())))
check(S, cnt=0)