# require 'pry'
str = gets.chomp.split('')

r0 = 0
r1 = 0
# binding.pry
str.each do |s|
  case s
  when "0"
    if r1 > 0
      r1 -= 1
    else
      r0 += 1
    end
  when "1"
    if r0 > 0
      r0 -= 1
    else
      r1 += 1
    end
  end
end
# puts r0, r1
puts str.size - r0 - r1