def f(x) res=x.map{|e| ["A23456789TJQK".index(e[1]),e] } return res.sort.map{|e| e[1] } end gets x=gets.chomp.split d=[] c=[] h=[] s=[] x.each{|e| case e[0] when "D" d<