
def resolve():
    inp = input()
    result = inp

    while True:
        before = len(result)
        result = result.replace('01', '')
        result = result.replace('10', '')
        after = len(result)
        if before == after:
            break

    print(len(inp)-len(result))

resolve()