33 lines
790 B
Text
33 lines
790 B
Text
#APPTYPE CONSOLE
|
|
|
|
FUNCTION RESTfulGET(url)
|
|
DIM %HTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
|
|
CALLMETHOD(HTTP, ".open %s, %s, %d", "GET", url, FALSE)
|
|
CALLMETHOD(HTTP, ".send")
|
|
RETURN GETVALUE("%s", HTTP, ".ResponseText")
|
|
END FUNCTION
|
|
|
|
DIM $TEXT = RESTfulGET("http://www.puzzlers.org/pub/wordlists/unixdict.txt")
|
|
DIM dict[] = Split(TEXT, CHR(10))
|
|
DIM max AS INTEGER = UBOUND(dict)
|
|
DIM theword AS STRING
|
|
DIM words[]
|
|
FOR DIM i = 0 TO max
|
|
theWord = dict[i]
|
|
IF isOrdered(theWord) THEN
|
|
words[LEN(theWord)] = words[LEN(theWord)] & " " & theWord
|
|
END IF
|
|
NEXT
|
|
|
|
PRINT words[UBOUND(words)]
|
|
|
|
PAUSE
|
|
|
|
FUNCTION isOrdered(s)
|
|
FOR DIM i = 1 TO LEN(s) - 1
|
|
IF s{i} > s{i + 1} THEN
|
|
RETURN FALSE
|
|
END IF
|
|
NEXT
|
|
RETURN TRUE
|
|
END FUNCTION
|