aaa = Array.new(3,0) 3.times do |i| t = gets.chomp next if t == 'NONE' aaa[i] = t.split(',').size end puts aaa.map { |a| (16-a) ** 2 }.inject(:*)