31 lines
577 B
Text
31 lines
577 B
Text
import Nanoquery.IO
|
|
|
|
def is_ordered(word)
|
|
word = str(word)
|
|
if len(word) < 2
|
|
return true
|
|
end
|
|
|
|
for i in range(1, len(word) - 1)
|
|
if str(word[i]) < str(word[i - 1])
|
|
return false
|
|
end
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
longest = 0
|
|
words = {}
|
|
for word in new(File, "unixdict.txt").read()
|
|
if is_ordered(word)
|
|
if len(word) > longest
|
|
longest = len(word)
|
|
words.clear()
|
|
words.append(word)
|
|
else if len(word) = longest
|
|
words.append(word)
|
|
end
|
|
end
|
|
end
|
|
println words
|