Jump to content

ABC words: Difference between revisions

m
→‎{{header|REXX}}: added comments, changed indentation, added a 2nd output section for the vowels in order.
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:
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; upper x; !.#= x /*save: original case. */
end /*#*/ /* [↑] semaphore name is uppercased. */
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. */
do j=1 for #-1 /*process all the words that were found*/
if verify(chrschrsU, $!.j)>0 then iterate /*All characters found? No, then skip.*/
p= 0 /*initialize the position location. */
p=0
do k=1 for L /*examine each letter of the ABC charts*/
_= pos( substr(chrschrsU, 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. */
say right(left($.j, 2030), 2440) /*indent original word for readability.*/
end /*j*/
say copies('─', 30) ABCs ' "ABC" words found using the characters: ' chrs</lang>
{{out|output|text=&nbsp; when using the default input:}}
'''output'''
<pre>
────────────────────────────── 25105 words in the dictionary file: unixdict.txt
aback
abacus
abc
abdicate
abduct
abeyance
abject
abreact
abscess
abscissa
abscissae
absence
abstract
abstracter
abstractor
adiabatic
aerobacter
aerobic
albacore
alberich
albrecht
algebraic
alphabetic
ambiance
ambuscade
aminobenzoic
anaerobic
arabic
athabascan
auerbach
diabetic
diabolic
drawback
fabric
fabricate
flashback
halfback
iambic
lampblack
leatherback
metabolic
nabisco
paperback
parabolic
playback
prefabricate
quarterback
razorback
roadblock
sabbatical
snapback
strabismic
syllabic
tabernacle
tablecloth
────────────────────────────── 55 "ABC" words found using the characters: abc
</pre>
 
{{out|output|text=&nbsp; when using the &nbsp;(vowels in order)&nbsp; input: &nbsp; &nbsp; <tt> aeiou </tt>}}
<pre>
────────────────────────────── 25105 words in the dictionary file: unixdict.txt
adventitious
p=0 facetious
────────────────────────────── 2 "ABC" words found using the characters: aeiou
</pre>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.