S = input()

char = S
last_len = 0
while len(char)!=last_len:
    last_len = len(char)
    char = char.replace("01","").replace("10","").replace("01","").replace("10","").replace("01","").replace("10","")
print(len(S)-len(char))