S = list(input())
i = 0
j = 1
count = 0

if len(S) != 1:
    while True:
        if S[i]=="0" and S[i+1]=="1" or S[i]=="1" and S[i+1]=="0":
            count += 1

            while i-j != -1 and i+j+1 != len(S):

                if i-j != 0 and S[i-j]=="0" and S[i+j+1]=="1" or S[i-j]=="1" and S[i+j+1]=="0":
                    count += 1
                    j += 1
                else:
                    S = S[:i-j+1] + S[i+j+1:]
                    j = 1
                    i = -1
                    break

        if i+j+1 == len(S):
            break
        
        i += 1
    
    print(count*2)
else:
    
    print(0)
