s = input()
n = len(s)
l = [int(x) for x in list(s)]

count = 0
flag = True

while flag == True:
    flag = False
    for i in range(n-1):
        if l[i] != l[i+1]:
            l = l[:i] + l[i+2:]
            count += 2
            n -= 2
            flag = True
            break

print(count)

