def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0

def fb(s, i):
    for i in reversed(range(0, i + 1)):
        if s[i] >= 0:
            return i
    return None

def ff(s, i):
    for i in range(i + 1, len(s)):
        if s[i] >= 0:
            return i
    return None

for i in range(len(s) - 1):
    j = 0
    while True:
        pos = fb(s, i - j), ff(s, i - j)
        if pos[0] is None:
            break

        if s[pos[0]] != s[pos[1]]:
            s[pos[0]] = s[pos[1]] = -1
            j += 1
            c += 2
        else:
            break

print(c)
