# -*- coding: utf-8 -*-

s = list(input())

# print(S)

i = 0
count = 0
s_sum = len(s)

while i + 1 < len(s):
    if s[i] != s[i + 1]:
        s.pop(i)
        s.pop(i)
        i = 0
        count += 1
    else:
        i += 1

print(count * 2)


