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

    while True:
        before = len(result)
        result = re.sub(r'01|10', '', result)
        after = len(result)
        if before == after:
            break

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

resolve()
