Changeable words: Difference between revisions

m
→‎{{header|REXX}}: changed whitespace and some comments, used a better variable name, optimized the inner DO loop.
m (→‎{{header|REXX}}: changed whitespace and some comments, used a better variable name, optimized the inner DO loop.)
Line 567:
Labc= length(abc) /*the length of the alphabet to be used*/
 
do j=1 for #-1; L= length($.j) /*process all the words that were found*/
if L<minL then iterate /*Is the word long enough? No, skip it*/
if \datatype($.j, 'M') then iterate /*verify that the word is all letters. */
x= $.j; upper x /*get an uppercased version of the word*/
finds= finds + 1 pad= left('', 9) /*bumpPAD: countused offor changeableindenting wordsthe foundoutput.*/
 
do k=1 for L; _y= substr(x, k, 1) /*y: the current letter being changed.*/
do c=1 for Labc /* [↓] change the _ letter to another.*/
?= substr(abc, c, 1) /*get a new char to replace one in word*/
if ?==_y then iterate /*Is this the same char? Then use next*/
new= overlay(?, x, k) /*create a spanking new (changed) word.*/
newU= new; upper newU /*get an uppercase version of new word.*/
if @.newU=='' then iterate /*if the new word isn't a word, skip it*/
leave k finds= finds + 1 /*webump foundcount aof newchangeable word,words stop searchingfound.*/
say right(pad left($.j, 30), 40) @.newU /*indent original word for readability.*/
end /*c*/
if k==L then iterate j /*No new word found? Then try another.*/
end /*k*/
end /*j*/
 
finds= finds + 1 /*bump count of changeable words found.*/
say right( left($.j, 30), 40) @.newU /*indent original word for readability.*/
end /*j*/
say copies('─', 30) finds ' changeable words found with a minimum length of ' minL</lang>
{{out|output|text=&nbsp; when using the default inputs:}}