a = gets.chomp.split(" ").map(&:to_i) a.delete(a.min) a.delete(a.max) p a.inject(:+).to_f/a.size