is_ordered = proc (s: string) returns (bool) last: char := '\000' for c: char in string$chars(s) do if last > c then return(false) end last := c end return(true) end is_ordered lines = iter (s: stream) yields (string) while true do yield(stream$getl(s)) except when end_of_file: break end end end lines ordered_words = proc (s: stream) returns (array[string]) words: array[string] max_len: int := 0 for word: string in lines(s) do if is_ordered(word) then len: int := string$size(word) if len > max_len then max_len := len words := array[string]$[] elseif len = max_len then array[string]$addh(words,word) end end end return(words) end ordered_words start_up = proc () dict: stream := stream$open(file_name$parse("unixdict.txt"), "read") words: array[string] := ordered_words(dict) stream$close(dict) po: stream := stream$primary_output() for word: string in array[string]$elements(words) do stream$putl(po, word) end end start_up