S = input()
N = len(S)

tmp = S
a = 0
b = 0
c = 0
count = 0
if len(tmp)-1 == b:
    a = 1
while a == 0:
    if tmp[b] != tmp[b+1]:
        if len(tmp) == 2:
            tmp = ''
            break
        else:
            count += 1
            tmp = tmp[:b] + tmp[b+2:]
            b = 0
            c += 1
    else:
        b += 1
        if len(tmp)-1 == b:
            a = 1

print(str(count*2))
