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
while True:
    i = 0
    while i < len(s) - 1:
        if s[i] != s[i + 1]:
            s[i] = s[i + 1] = -1
            i += 2
            c += 2
        i += 1
    s = [c for c in s if c >= 0]
    l = len([c for c in s if c == 0])
    if l == 0 or l == len(s):
        break

print(c)
