s = list(input())

ans = 0
flag = 1
while (flag):
    flag = 0
    i = 0
    loop_len = len(s)
    while (i < (loop_len - 1)):
        # print(loop_len)
        # print(s)
        if (s[i] != s[i + 1]):
            flag = 1
            ans += 2
            del s[i: i + 2]
        loop_len = len(s)
        i += 1

print(ans)
