Jump to content

Find words which contains more than 3 e vowels: Difference between revisions

→‎{{header|REXX}}: added the computer programming language REXX.
m (added highlighting.)
(→‎{{header|REXX}}: added the computer programming language REXX.)
Line 6:
Find words which contains more than three   '''e'''   vowels and contains only   '''e'''   vowels.
<br><br>
 
=={{header|REXX}}==
This REXX version doesn't care what order the words in the dictionary are in, &nbsp; nor does it care what
<br>case &nbsp;(lower/upper/mixed)&nbsp; the words are in, &nbsp; the search for the words and vowels is &nbsp; ''caseless''.
 
It also allows the minimum number of vowels to be specified on the command line (CL) as well as the dictionary file identifier.
<lang rexx>/*REXX pgm finds words (within an identified dict.) which contain more than three "e"s.*/
parse arg char many iFID . /*obtain optional arguments from the CL*/
if char=='' | char=="," then char= 'e' /*Not specified? Then use the default.*/
if many=='' | many=="," then many= 4 /* " " " " " " */
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
chrU= char; upper chrU /*obtain an uppercase version of char.*/
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: the original case of the word.*/
end /*#*/ /* [↑] semaphore name is uppercased. */
#= # - 1 /*adjust word count because of DO loop.*/
say copies('─', 30) # "words in the dictionary file: " iFID
finds= 0 /*count of the "eeee" words found. */
 
do j=1 for #; $= @.j /*process all the words that were found*/
upper $ /*uppercase it for caseless finds. */
if pos(chrU, $)==0 then iterate /*At least 1 vowel found? No, then skip*/
if countstr(chrU, $) < many then iterate /*Have enough vowels? " " " */
finds= finds + 1 /*bump the count of "ABC" words found. */
say right(left(@.j, 30), 40) /*indent original word for readability.*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 30) finds ' "e" words found using the characters: ' many "'e'"</lang>
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
────────────────────────────── 25104 words in the dictionary file: unixdict.txt
accelerometer
belvedere
betelgeuse
centerpiece
cheerleader
cheesecake
decelerate
degenerate
dereference
desegregate
electroencephalogram
electroencephalograph
electroencephalography
elsewhere
entrepreneur
entrepreneurial
ephemerides
erlenmeyer
evergreen
everywhere
exegete
experience
eyepiece
freewheel
genevieve
heterogeneity
heterogeneous
inexperience
interference
interferometer
interviewee
irredeemable
leeuwenhoek
minesweeper
nevertheless
perseverance
persevere
preference
referee
refereeing
reprehensible
representative
reverberate
seventeen
seventeenth
speedometer
squeegee
steeplechase
teleconference
telemeter
teletypesetting
teletypewrite
tennessee
weatherbeaten
wheresoever
────────────────────────────── 55 "e" words found using the characters: 4 'e'
</pre>
 
=={{header|Ring}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.