a = input()
l = len(a)
blk = a
i = 0
rem = 0
while i < (l - 1):
    if(blk[i] != blk[i+1]):
        blk = blk[:i] + blk[i+2:]
        l -= 2
        rem += 2
        i = 0
    else:
        i += 1
    
print(rem)