s = gets.chomp!
flag=0;count = 0
while flag==0 do
    flag = 1
    (s.length-1).times do|i|
        if s[i] != s[i+1] then
            s.slice!(i, 2)
            count += 1
            flag = 0
            break
        end
    end
end
puts count*2