Changeable words: Difference between revisions

m
→‎{{header|REXX}}: moved a filter to the READ loop (from the scan loop).
(Added C solution)
m (→‎{{header|REXX}}: moved a filter to the READ loop (from the scan loop).)
Line 760:
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
@.= /*default value of any dictionary word.*/
wc= 0 /*WC: the word count of usable words.*/
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/
x= strip( linein( iFID) ) /*pick off a word from the input line. */
$.#=if length(x;)<minL then iterate upper x; @.x= $.# /*save: original case. Is the word too short? Then skip it.*/
if \datatype(x, 'M') then iterate /* " " " not alphabetic? Skip it.*/
wc= wc+1; $.wc= x; upper x; @.x= $.wc /*bump word counter; save original case*/
end /*#*/ /* [↑] semaphore name is uppercased. */
 
Line 770 ⟶ 773:
Labc= length(abc) /*the length of the alphabet to be used*/
 
do j=1 for #-1wc; 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*/