class Card attr_reader :suit, :num def initialize(str) @str = str @suit = case str[0] when "D" then 1 when "C" then 2 when "H" then 3 when "S" then 4 end @num = case str[1] when "A" then 1 when "T" then 10 when "J" then 11 when "Q" then 12 when "K" then 13 else str[1].to_i end end def <=>(other) [suit, num] <=> [other.suit, other.num] end def to_s @str end end gets puts gets.split.map{|s| Card.new(s)}.sort.join(" ")