s = gets.chomp ary = s.chars.map(&:to_i).sort ary2 = ary.reverse.map(&:to_s) str = "" ary2.each do |num| str += num end puts str.to_i