s=gets.chomp

n=s.length
count=0
(n/2).times do |i|
    check=false
    (s.length-1).times do |j|
        if s[j]!=s[j+1]
            s.slice!(j,2)
            count+=2
            check=true
            break
        end
    end
    unless check
        break
    end
end
puts count
