Medal Rankings by clock

$_,*m=*$<
puts split.map{|x|[x,[0,4,8].map{|p|m.grep(/^.{#{p}}#{x}/).size}]*" "}.sort_by{|y|s=y[4,5];[s.sum,s]}.reverse

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top