def main():
    s=s0=input()
    while True:
        i=s.find('01')
        if i>=0:
            s=s[:i]+s[i+2:]
            continue
        i=s.find('10')
        if i>=0:
            s=s[:i]+s[i+2:]
            continue
        break
    print(len(s0)-len(s))

main()