Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,15 +1,15 @@
|
|||
/*REXX program finds palindrome pairs using a dictionary (UNIXDICT.TXT)*/
|
||||
#=0 /*number of palindromes (so far).*/
|
||||
parse arg iFID .; if iFID=='' then iFID='UNIXDICT.TXT' /*use default?*/
|
||||
@.= /*caseless non-duplicated words. */
|
||||
do while lines(ifid)\==0; _=linein(iFID); u=translate(space(_,0))
|
||||
if length(u)<2 | @.u\=='' then iterate /*can't be a unique pal.*/
|
||||
r=reverse(u)
|
||||
if @.r\=='' then do; #=#+1 /*found palindrome pair.*/
|
||||
if #<6 then say @.r',' _ /*only list first 5 pals*/
|
||||
end
|
||||
@.u=_
|
||||
end /*while*/
|
||||
say /*a unique palindrome pair = a semordnilap*/
|
||||
say "There're" # 'unique palindrome pairs in the dictionary file:' iFID
|
||||
/*REXX program finds palindrome pairs using a dictionary (UNIXDICT.TXT).*/
|
||||
#=0 /*# palindromes (so far)*/
|
||||
parse arg iFID .; if iFID=='' then iFID='UNIXDICT.TXT' /*use default?*/
|
||||
@.= /*caseless no-duped word*/
|
||||
do while lines(iFID)\==0; _=space(linein(iFID),0); parse upper var _ u
|
||||
if length(_)<2 | @.u\=='' then iterate /*can't be a unique pal.*/
|
||||
r=reverse(u) /*get the reverse of U. */
|
||||
if @.r\=='' then do; #=#+1 /*found palindrome pair?*/
|
||||
if #<6 then say @.r',' _ /*only list first 5 pals*/
|
||||
end /* [↑] bump count, show*/
|
||||
@.u=_ /*define palindromic pal*/
|
||||
end /*while*/ /* [↑] read dictionary.*/
|
||||
say
|
||||
say "There're" # 'unique palindrome pairs in the dictionary file: ' iFID
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue