49 lines
1.2 KiB
Text
49 lines
1.2 KiB
Text
$ include "seed7_05.s7i";
|
|
|
|
const func boolean: isOrdered (in string: word) is func
|
|
result
|
|
var boolean: ordered is TRUE;
|
|
local
|
|
var integer: index is 0;
|
|
begin
|
|
for index range 1 to pred(length(word)) do
|
|
if word[index] > word[succ(index)] then
|
|
ordered := FALSE;
|
|
end if;
|
|
end for;
|
|
end func;
|
|
|
|
const proc: write (in array string: wordList) is func
|
|
local
|
|
var string: word is "";
|
|
begin
|
|
for word range wordList do
|
|
writeln(word);
|
|
end for;
|
|
end func;
|
|
|
|
const proc: main is func
|
|
local
|
|
var file: dictionary is STD_NULL;
|
|
var string: word is "";
|
|
var integer: length is 0;
|
|
var array string: wordList is 0 times "";
|
|
begin
|
|
dictionary := open("unixdict.txt", "r");
|
|
if dictionary <> STD_NULL then
|
|
readln(dictionary, word);
|
|
while not eof(dictionary) do
|
|
if isOrdered(lower(word)) then
|
|
if length(word) > length then
|
|
length := length(word);
|
|
wordList := [] (word);
|
|
elsif length(word) = length then
|
|
wordList &:= word;
|
|
end if;
|
|
end if;
|
|
readln(dictionary, word);
|
|
end while;
|
|
close(dictionary);
|
|
end if;
|
|
write(wordList);
|
|
end func;
|