Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
37
Task/Semordnilap/Seed7/semordnilap.seed7
Normal file
37
Task/Semordnilap/Seed7/semordnilap.seed7
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "gethttp.s7i";
|
||||
|
||||
const func string: reverse (in string: word) is func
|
||||
result
|
||||
var string: drow is "";
|
||||
local
|
||||
var integer: index is 0;
|
||||
begin
|
||||
for index range length(word) downto 1 do
|
||||
drow &:= word[index];
|
||||
end for;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var array string: wordList is 0 times "";
|
||||
var set of string: words is (set of string).value;
|
||||
var string: word is "";
|
||||
var string: drow is "";
|
||||
var integer: count is 0;
|
||||
begin
|
||||
wordList := split(lower(getHttp("www.puzzlers.org/pub/wordlists/unixdict.txt")), "\n");
|
||||
for word range wordList do
|
||||
drow := reverse(word);
|
||||
if drow not in words then
|
||||
incl(words, word);
|
||||
else
|
||||
if count < 5 then
|
||||
writeln(word <& " " <& drow);
|
||||
end if;
|
||||
incr(count);
|
||||
end if;
|
||||
end for;
|
||||
writeln;
|
||||
writeln("Semordnilap pairs: " <& count);
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue