S = input()
def del_01(char):
    char_1 = char.replace("01","").replace("10","")
    return char_1

char = S
last_len = 0
while len(char)!=last_len:
    last_len = len(char)
    char = del_01(char)
print(len(S)-len(char))