RosettaCodeData/Task/Ordered-words/E/ordered-words-2.e

12 lines
359 B
Text
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
def best := [].diverge()
for `@word$\n` ? (word.sort() <=> word) in <http://www.puzzlers.org/pub/wordlists/unixdict.txt> {
if (best.size() == 0) {
best.push(word)
} else if (word.size() > best[0].size()) {
best(0) := [word] # replace all
} else if (word.size() <=> best[0].size()) {
best.push(word)
}
}
println(" ".rjoin(best.snapshot()))