RosettaCodeData/Task/Ordered-words/Ruby/ordered-words-2.rb
2015-11-18 06:14:39 +00:00

2 lines
148 B
Ruby

words = IO.foreach('unixdict.txt').map(&:chomp).select {|word| word.chars.sort.join == word}
puts words.group_by(&:size).sort_by(&:first).last.last