# a, b, k = map(int, input().split())
s = input()

n = len(s)


def rep(str):
    str = str.replace('01', '')
    str = str.replace('10', '')
    return str


input_str = s
ret = None

while ret is None or input_str != ret:
    ret = input_str
    input_str = rep(input_str)

print(n - len(ret))
