import re

def main():
    s = input()

    hoji = len(s)

    count = len(s) // 2
    while count > 0:
        try:
            s = re.sub('01|10',"",s)
        except:
            break
        count -= 1


    print(hoji - len(s))

if __name__ == '__main__':
    main()