s = input()
init_len = len(s)
tmp_s_len = 0
while tmp_s_len != len(s):
    tmp_s_len = len(s)
    s = s.replace("01","").replace("10","")
    if s == "":
        break
    else:
        continue
res = init_len - tmp_s_len
print(res)
