Find words which contains more than 3 e vowels

From Rosetta Code
Revision as of 06:18, 9 February 2021 by rosettacode>Gerard Schildberger (added highlighting.)
Find words which contains more than 3 e vowels is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task

Use the dictionary   unixdict.txt

Find words which contains more than three   e   vowels and contains only   e   vowels.

Ring

<lang ring> load "stdlib.ring"

cStr = read("unixdict.txt") wordList = str2list(cStr) char = list(9) nextwords = [] nr = 0 num = 0

see "working..." + nl

ln = len(wordList) for n = ln to 1 step -1

   if len(wordList[n]) < 6
      del(wordList,n)
   ok

next

see "Words are:" + nl

for n = 1 to len(wordList)

   num = 0
   flag = 1
   for m = 1 to len(wordList[n])
       if isvowel(wordList[n][m])
          if wordList[n][m] != "e"
             flag = 0
             exit
          else
             num = num + 1
          ok
       ok
   next
   if flag = 1 and num > 3
      nr = nr + 1
      see "" + nr + ". " + wordList[n] + nl
   ok

next

see "done..." + nl </lang> Output:

working...
Words are:
1. belvedere
2. dereference
3. elsewhere
4. erlenmeyer
5. evergreen
6. everywhere
7. exegete
8. freewheel
9. nevertheless
10. persevere
11. preference
12. referee
13. seventeen
14. seventeenth
15. telemeter
16. tennessee
done...