def resolve():
    s = input()
    c = 0
    while True:
        for i in range(len(s)-1):
            if s[i] != s[i+1]:
                s = s[:i] + s[i+2:]
                c += 2
                break
        if len(set(s)) == 0 or len(set(s)) == 1:
            break
    print(c)
resolve()