Ordered words: Difference between revisions

Lingo added
m (→‎Task: wording)
(Lingo added)
Line 2,231:
glossy
knotty </pre>
 
=={{header|Lingo}}==
Code ported from Lua solution.
<lang lingo>-- Contents of unixdict.txt passed as string
on printLongestOrderedWords (words)
_player.itemDelimiter = numtochar(10)
maxlen = 0
res = []
cnt = words.item.count
repeat with i = 1 to cnt
if i mod 1000=0 then put i
w = words.item[i]
len = w.length
ordered = TRUE
repeat with l = 2 to len
if chartonum(w.char[l-1])>chartonum(w.char[l]) then
ordered = FALSE
exit repeat
end if
end repeat
if ordered then
if len > maxlen then
res = [w]
maxlen = len
else if len = maxlen then
res.add(w)
end if
end if
end repeat
put res
end</lang>
{{Out}}
<pre>-- ["abbott", "accent", "accept", "access", "accost", "almost", "bellow", "billow", "biopsy", "chilly", "choosy", "choppy", "effort", "floppy", "glossy", "knotty"]</pre>
 
=={{header|Lua}}==
Anonymous user