Jump to content

ABC words: Difference between revisions

m
→‎{{header|REXX}}: added the computer programming language REXX.
(Added C# version, allows user specified pattern)
m (→‎{{header|REXX}}: added the computer programming language REXX.)
Line 414:
fabric fabricate flashback halfback iambic lampblack leatherback metabolic nabisco paperback parabolic
playback prefabricate quarterback razorback roadblock sabbatical snapback strabismic syllabic tabernacle tablecloth </pre>
 
=={{header|REXX}}==
<lang rexx>/*REXX pgm finds "ABC" words (within an identified dict.) where ABC are found in order.*/
parse arg chrs iFID . /*obtain optional arguments from the CL*/
if chrs=='' | chrs=="," then chrs= 'abc' /* " " " " " " */
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
@.= /*default value of any dictionary word.*/
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 /*save: original case. */
end /*#*/ /* [↑] semaphore name is uppercased. */
say copies('─', 30) # "words in the dictionary file: " iFID
L = length(chrs)
ABCs= 0 /*count of the "ABC" words found. */
do j=1 for #-1 /*process all the words that were found*/
if verify(chrs, $.j)>0 then iterate
p=0
do k=1 for L
_= pos( substr(chrs, k, 1), $.j)
if _<p then iterate j
p= _
end
ABCs= ABCs + 1 /*bump the count of "ABC" words found. */
say right(left($.j, 20), 24) /*indent original word for readability.*/
end /*j*/
say copies('─', 30) ABCs ' "ABC" words found using the characters: ' chrs</lang>
'''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>
 
=={{header|Ring}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.