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

n = len(s)


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

    if ret != str:
        ret = rep(ret)

    return ret


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

ret = rep(s)

print(n - len(ret))
