RosettaCodeData/Task/Ordered-words/Ruby/ordered-words-2.rb

3 lines
148 B
Ruby
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
words = IO.foreach('unixdict.txt').map(&:chomp).select {|word| word.chars.sort.join == word}
puts words.group_by(&:size).sort_by(&:first).last.last