Jump to content

Ordered words: Difference between revisions

no edit summary
No edit summary
Line 2,570:
glossy
knotty</pre>
 
=={{header|Nanoquery}}==
<lang Nanoquery>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</lang>
 
{{out}}
<pre>[abbott, accent, accept, access, accost, almost, bellow, billow, biopsy, chilly, choosy, choppy, effort, floppy, glossy, knotty]</pre>
 
=={{header|NetRexx}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.