s = gets.chomp
i = 0
ans = 0

while true
    if i >= s.length - 1
        break
    end

    if s[i] != s[i+1]
        s.slice!(i, 2)
        i = 0
        ans += 1
        next
    end
    i += 1
end

puts ans * 2