def main():
    S = input()
    t = len(list(S))
    while True:

        temp = S
        if '01' in S:
            S = S.replace('01', '')
        if '10' in S:
            S = S.replace('10', '')
        
        if temp == S:
            break
    print(t-len(list(S)))


if __name__ == '__main__':
    main()