import collections





S = eval(input())

N = len(S)



c = collections.Counter(S)



if len(c) == 1:

    print((0))

else:

    print((c.most_common()[-1][1]*2))

S = eval(input())



num_0 = S.count('0')

num_1 = S.count('1')



print((min(num_0, num_1)*2))

import collections

S = eval(input())
N = len(S)
c = collections.Counter(S)
if len(c) == 1:
    print((0))
else:
    print((c.most_common()[-1][1] * 2))

S = eval(input())
num_0 = S.count("0")
num_1 = S.count("1")
print((min(num_0, num_1) * 2))

-import collections - -N = len(S) -c = collections.Counter(S) -if len(c) == 1: -    print((0)) -else: -    print((c.most_common()[-1][1] * 2)) +num_0 = S.count("0") +num_1 = S.count("1") +print((min(num_0, num_1) * 2))