import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from collections import deque

def main():
    s = IS()
    dq = deque()
    n = len(s)
    dq.append(s[0])
    cnt = 0
    idx = 1
    while idx < n:
        if not len(dq) > 0: dq.append(s[idx]); continue
        a = dq[-1]
        b = s[idx]
        if a == b:
            dq.append(b)
        else:
            dq.pop()
            cnt += 2
        idx += 1
    print(cnt)

if __name__ == '__main__':
    main()
