def remove(s):
    r = None
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            r = s[0:i] + s[i+2:]
            break
    return r


def calc(s):
    count = 0
    c = s
    while True:
        t = remove(c)
        if t == None:
            break
        count += 2
        c = t
    return count


s = input()
print(calc(s))
