ABC words: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added wording to the REXX section header.) |
m (→{{header|REXX}}: added comments, changed indentation, added a 2nd output section for the vowels in order.) |
||
Line 427: | Line 427: | ||
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/ |
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. */ |
x= strip( linein( iFID) ) /*pick off a word from the input line. */ |
||
$.#= x |
$.#= x; upper x; !.#= x /*save: original case. */ |
||
end /*#*/ /* [↑] semaphore name is uppercased. */ |
end /*#*/ /* [↑] semaphore name is uppercased. */ |
||
say copies('─', 30) # "words in the dictionary file: " iFID |
say copies('─', 30) # "words in the dictionary file: " iFID |
||
L = length(chrs) /*obtain the length of the ABC chars.*/ |
|||
L = length(chrs) |
|||
chrsU= chrs; upper chrsU /*obtain an uppercase version of chrs.*/ |
|||
ABCs= 0 /*count of the "ABC" words found. */ |
ABCs= 0 /*count of the "ABC" words found. */ |
||
do j=1 for #-1 /*process all the words that were found*/ |
do j=1 for #-1 /*process all the words that were found*/ |
||
if verify( |
if verify(chrsU, !.j)>0 then iterate /*All characters found? No, then skip.*/ |
||
p= 0 /*initialize the position location. */ |
|||
⚫ | |||
do k=1 for L /*examine each letter of the ABC charts*/ |
|||
_= pos( substr(chrsU, k, 1), !.j) /*find the position of the Kth letter.*/ |
|||
if _<p then iterate j /*Less than the previous? Then skip it*/ |
|||
p= _ /*save the position of the last letter.*/ |
|||
end /*k*/ |
|||
ABCs= ABCs + 1 /*bump the count of "ABC" words found. */ |
ABCs= ABCs + 1 /*bump the count of "ABC" words found. */ |
||
say right(left($.j, |
say right(left($.j, 30), 40) /*indent original word for readability.*/ |
||
end /*j*/ |
end /*j*/ |
||
say copies('─', 30) ABCs ' "ABC" words found using the characters: ' chrs</lang> |
say copies('─', 30) ABCs ' "ABC" words found using the characters: ' chrs</lang> |
||
{{out|output|text= when using the default input:}} |
|||
'''output''' |
|||
<pre> |
<pre> |
||
────────────────────────────── 25105 words in the dictionary file: unixdict.txt |
────────────────────────────── 25105 words in the dictionary file: unixdict.txt |
||
aback |
aback |
||
abacus |
abacus |
||
abc |
abc |
||
abdicate |
abdicate |
||
abduct |
abduct |
||
abeyance |
abeyance |
||
abject |
abject |
||
abreact |
abreact |
||
abscess |
abscess |
||
abscissa |
abscissa |
||
abscissae |
abscissae |
||
absence |
absence |
||
abstract |
abstract |
||
abstracter |
abstracter |
||
abstractor |
abstractor |
||
adiabatic |
adiabatic |
||
aerobacter |
aerobacter |
||
aerobic |
aerobic |
||
albacore |
albacore |
||
alberich |
alberich |
||
albrecht |
albrecht |
||
algebraic |
algebraic |
||
alphabetic |
alphabetic |
||
ambiance |
ambiance |
||
ambuscade |
ambuscade |
||
aminobenzoic |
aminobenzoic |
||
anaerobic |
anaerobic |
||
arabic |
arabic |
||
athabascan |
athabascan |
||
auerbach |
auerbach |
||
diabetic |
diabetic |
||
diabolic |
diabolic |
||
drawback |
drawback |
||
fabric |
fabric |
||
fabricate |
fabricate |
||
flashback |
flashback |
||
halfback |
halfback |
||
iambic |
iambic |
||
lampblack |
lampblack |
||
leatherback |
leatherback |
||
metabolic |
metabolic |
||
nabisco |
nabisco |
||
paperback |
paperback |
||
parabolic |
parabolic |
||
playback |
playback |
||
prefabricate |
prefabricate |
||
quarterback |
quarterback |
||
razorback |
razorback |
||
roadblock |
roadblock |
||
sabbatical |
sabbatical |
||
snapback |
snapback |
||
strabismic |
strabismic |
||
syllabic |
syllabic |
||
tabernacle |
tabernacle |
||
tablecloth |
tablecloth |
||
────────────────────────────── 55 "ABC" words found using the characters: abc |
────────────────────────────── 55 "ABC" words found using the characters: abc |
||
</pre> |
|||
{{out|output|text= when using the (vowels in order) input: <tt> aeiou </tt>}} |
|||
<pre> |
|||
────────────────────────────── 25105 words in the dictionary file: unixdict.txt |
|||
adventitious |
|||
⚫ | |||
────────────────────────────── 2 "ABC" words found using the characters: aeiou |
|||
</pre> |
</pre> |
||