import collections as co
S = co.deque(input())
prev = 0
cnt = 0
while prev != len(S):
    prev = len(S)
    for i, s in enumerate(S):
        if i == 0:
            continue
        if s != S[i-1]:
            del(S[i-1])
            del(S[i-1])
            cnt += 2
            break
print(cnt)