import itertools
import sys
input = sys.stdin.readline

S = list(map(int, list(input().rstrip('\n'))))
temp = S.copy()

for k in itertools.count():
    for i in range(len(temp) - 1):
        if temp[i] != temp[i + 1]:
            temp.pop(i)
            temp.pop(i)
            break
    if temp.count(0) == len(temp) or temp.count(1) == len(temp):
        break

print(len(S)-len(temp))
