s = list(map(str, input()))

change = 0
count = 0
i = 0

while True:
    if not s:
        break
    if i + 1 >= len(s):
        if change != 0:
            i = 0
            change = 0
        else:
            break

    if s[i] != s[i + 1]:
        del s[i: i + 2]
        count += 1
        change += 1
    else:
        i += 1

print(count * 2)
