a = list(input().strip())
# print(a)
i = 0
ans = 0
while True:
    if len(a) < 2:
        break
    if a[i] != a[i + 1]:
        ans += 1
        a.pop(i + 1)
        a.pop(i)
    # print(len(a))
    # print(a)
    i += 1
    if i >= len(a) - 2:
        i = 0
    if len(list(set(a))) == 1 or len(a) == 0:
        break
print(ans * 2)