Anonymous user
Find words with alternating vowels and consonants: Difference between revisions
Find words with alternating vowels and consonants (view source)
Revision as of 16:58, 5 April 2021
, 3 years ago→{{header|REXX}}: added/changed comments, changed whitespace.
(Added Forth solution) |
m (→{{header|REXX}}: added/changed comments, changed whitespace.) |
||
Line 1,900:
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
do #=1 while lines(iFID)\==0
x= strip( linein( iFID) )
$.#= x; upper x
end /*#*/
#= # - 1 /*adjust the record count (DO loop). */
say copies('─', 30) # "words in the dictionary file: " iFID; say
finds= 0 /*count of the words found (so far). */
vow= '
@@@= /* " " " words found (so far). */▼
w= 0 /*the maximum length of any word found.*/
do ec=2 by 2 to L; z= substr(y, ec, 1) /*examine the odd letters in the word. */
if verify(z, vow)>0 then ocev= 0 /*Even letter not a vowel? Then flunk.*/
if ovec==0 &
finds= finds + 1
w= max(w, L)
@@@= @@@ $.j
end /*j*/
▲ do ev=2 by 2 to L /*only scan eve indexed letters in word*/
▲ z= substr(y, ev, 1) /*examine the odd letters in the word. */
▲ if verify(z, con)>0 then ovec= 0 /*Even letter not a consonant? Flunk. */
▲ end /*k*/
▲ do oc=1 by 2 to L /*only scan odd indexed letters in word*/
▲ z= substr(y, oc, 1) /*examine the odd letters in the word. */
▲ if verify(z, con)>0 then ocev= 0 /*Odd letter not a consonant? Flunk. */
▲ end /*k*/
▲ do ec=2 by 2 to L /*only scan eve indexed letters in word*/
▲ z= substr(y, ec, 1) /*examine the odd letters in the word. */
▲ if verify(z, vow)>0 then ocev= 0 /*Even letter not a vowel? Then flunk.*/
▲ end /*k*/
▲ end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 30) finds ' words found with a minimum length of ' minL
_=
do out=1 for finds; z= word(@@@, out)
if length(_ right(z, w))>130 then do; say substr(_, 2); _=; end /*show a line.*/
_= _ right(z, w) /*append (aligned word) to output line.*/
|