Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -1,17 +1,6 @@
|
|||
$ 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 "";
|
||||
|
|
@ -20,7 +9,7 @@ const proc: main is func
|
|||
var string: drow is "";
|
||||
var integer: count is 0;
|
||||
begin
|
||||
wordList := split(lower(getHttp("www.puzzlers.org/pub/wordlists/unixdict.txt")), "\n");
|
||||
wordList := split(lower(getHttp("wiki.puzzlers.org/pub/wordlists/unixdict.txt")), "\n");
|
||||
for word range wordList do
|
||||
drow := reverse(word);
|
||||
if drow not in words then
|
||||
|
|
|
|||
1
Task/Semordnilap/Uiua/semordnilap.uiua
Normal file
1
Task/Semordnilap/Uiua/semordnilap.uiua
Normal file
|
|
@ -0,0 +1 @@
|
|||
&p &pf "Count: " ⧻.▽≡(×>⇌.⟜∊⇌)⟜¤. ⊜□ ≠@\n. &fras "unixdict.txt"
|
||||
60
Task/Semordnilap/Yabasic/semordnilap.basic
Normal file
60
Task/Semordnilap/Yabasic/semordnilap.basic
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
dim norm$(27000), result$(270, 2)
|
||||
|
||||
print "Start reading unixdict.txt"
|
||||
open "i:\unixdict.txt" for reading as #1
|
||||
|
||||
while not(eof(#1)) // read to end of file
|
||||
line input #1 in_str$ // get line = word
|
||||
in_str$ = trim$(in_str$) // we don//t want spaces
|
||||
if len(in_str$) > 1 then // if length > 1 then reverse$
|
||||
rev$ = reverse$(in_str$)
|
||||
if in_str$ <> rev$ then // if in_str is not a palingdrome
|
||||
count = count + 1 // increase counter
|
||||
norm$(count) = in_str$ // store in the array
|
||||
big$ = big$ + rev$ + " " // create big string with reverse$d words
|
||||
fi
|
||||
fi
|
||||
wend
|
||||
|
||||
close #1
|
||||
print " ... Done"
|
||||
print
|
||||
print "Start looking for semordnilap"
|
||||
|
||||
for i = 1 to count
|
||||
for j = 1 to amount // check to avoid the double
|
||||
if result$(j, 2) = norm$(i) continue
|
||||
next j
|
||||
j = instr(big$, " " + norm$(i) + " ")
|
||||
if j <> 0 then // found one
|
||||
amount = amount + 1 // increase counter
|
||||
result$(amount, 1) = norm$(i) // store normal word
|
||||
result$(amount, 2) = reverse$(norm$(i)) // store reverse$ word
|
||||
fi
|
||||
next i
|
||||
|
||||
print
|
||||
print "Found", amount, " unique semordnilap pairs"
|
||||
print
|
||||
print "Display 5 semordnilap pairs"
|
||||
print
|
||||
|
||||
count = 0
|
||||
for i = 1 to amount
|
||||
if len(result$(i, 1)) >= 5 then
|
||||
count = count + 1
|
||||
print result$(i, 1), chr$(9), result$(i, 2)
|
||||
if count >= 5 break
|
||||
fi
|
||||
next i
|
||||
end
|
||||
|
||||
sub reverse$(norm$)
|
||||
local rev$, i, l
|
||||
l = len(norm$) - 1
|
||||
rev$ = norm$
|
||||
for i = 0 to l
|
||||
mid$(rev$, l - i, 1) = mid$(norm$, i, 1)
|
||||
next i
|
||||
return rev$
|
||||
end sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue