28 lines
604 B
Text
28 lines
604 B
Text
|
|
-- Contents of unixdict.txt passed as string
|
||
|
|
on printLongestOrderedWords (words)
|
||
|
|
res = []
|
||
|
|
maxlen = 0
|
||
|
|
_player.itemDelimiter = numtochar(10)
|
||
|
|
cnt = words.item.count
|
||
|
|
repeat with i = 1 to cnt
|
||
|
|
w = words.item[i]
|
||
|
|
len = w.length
|
||
|
|
ordered = TRUE
|
||
|
|
repeat with j = 2 to len
|
||
|
|
if chartonum(w.char[j-1])>chartonum(w.char[j]) 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
|