S = input()
len_s = len(S)
while(True):
    S = S.replace("01", "")
    S = S.replace("10", "")
    S = S.replace("01", "")
    S = S.replace("10", "")
    S = S.replace("01", "")
    S = S.replace("10", "")
    S = S.replace("01", "")
    S = S.replace("10", "")
    S = S.replace("01", "")
    S = S.replace("10", "")
    if not "01" in S:
        if not "10" in S:
            break
print(len_s - len(S))