l = [0]*10**6
l[0] = input()
i = 1

while True:
    l[i] = l[i-1].replace("10", "").replace("01","")
    if "10" not in l[i] and "01" not in l[i]:
        print(len(l[0]) - len(l[i]))
        exit()
    i += 1