1
2
3
4
5
6
7
8
9
counts = Array.new(8) { Hash.new(0) }
DATA.read.lines.each.with_object(counts) do |line, counts|
  (0..7).each do |i|
    counts[i][line[i]] += 1
  end
end
p counts.map {|h| h.sort_by(&:last).first.first }.join

__END__