RosettaCodeData/Task/Ordered-words/Run-BASIC/ordered-words.basic

21 lines
467 B
Plaintext

a$ = httpget$("http://www.puzzlers.org/pub/wordlists/unixdict.txt")
j = 1
i = instr(a$,chr$(10),j)
while i <> 0
a1$ = mid$(a$,j,i-j)
for k = 1 to len(a1$) - 1
if mid$(a1$,k,1) > mid$(a1$,k+1,1) then goto [noWay]
next k
maxL = max(maxL,len(a1$))
if len(a1$) >= maxL then a2$ = a2$ + a1$ + "||"
[noWay]
j = i + 1
i = instr(a$,chr$(10),j)
wend
n = 1
while word$(a2$,n,"||") <> ""
a3$ = word$(a2$,n,"||")
if len(a3$) = maxL then print a3$
n = n + 1
wend