import collections

S = list(eval(input()))

S.append('0')

S.append('1')

S_counter = collections.Counter(S)

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

S = eval(input())

r = S.count('0')

ans = min(len(S)-r,r)*2

print(ans)

import collections

S = list(eval(input()))
S.append("0")
S.append("1")
S_counter = collections.Counter(S)
print(((S_counter.most_common()[1][1] - 1) * 2))

S = eval(input())
r = S.count("0")
ans = min(len(S) - r, r) * 2
print(ans)

-import collections - -S = list(eval(input())) -S.append("0") -S.append("1") -S_counter = collections.Counter(S) -print(((S_counter.most_common()[1][1] - 1) * 2)) +S = eval(input()) +r = S.count("0") +ans = min(len(S) - r, r) * 2 +print(ans)