S = gets.chomp
s = S

cnt = 0

loop do
  break if s.length <= 1

  allSame = true
  (0...s.length-1).each do |i|
    if s[i] != s[i+1]
      cnt += 2
      s.slice!(i,2)
      allSame = false
      break
    end
  end
  break if allSame
end

puts cnt