s = input()
s = list(s)
count = 0
s_leng = len(s)
while s_leng >= 2:
    k = 1
    for i in range(1, s_leng):
        i0 = s[s_leng-k]
        i1 = s[s_leng-k-1]
        if i0 != i1:
            s.pop(s_leng-k)
            s.pop(s_leng-k-1)
            count += 2
            s_leng -= 2
            k += 1
        k += 1
        if s_leng-k < 0 or s_leng-k-1 < 0:
            break
    try:
        pk = [0, 1]
        pk.pop(int(s[0]))
        ik = str(pk[0])
        if ik not in s:
            break
    except:
        pass
    
    
print(count)