S = list(input())


def f():
    global S
    cnt = 0
    pre = ''
    pre_idx = -1
    for i, s in enumerate(S):
        if not s: continue

        if pre and s != pre:
            cnt += 2
            S[i] = ''
            S[pre_idx] = ''
            pre = ''
        else:
            pre = s
            pre_idx = i
    S = [s for s in S if s]
    return cnt


res = 0
while 1:
    tmp = f()
    if not tmp: break
    res += tmp

print(res)
