User talk:CalmoSoft/Find words which contains all the vowels

From Rosetta Code
Revision as of 13:56, 12 February 2021 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} ;Task: Use the dictionary  [https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt unixdict.txt] Find the words wh...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
CalmoSoft/Find words which contains all the 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 the words which contains all the vowels but each once.

The length of any word shown should have a length   >  10.

Ring

<lang ring> load "stdlib.ring"

cStr = read("unixdict.txt") wordList = str2list(cStr) num = 0 same = [] vowels = "aeiou"

see "working..." + nl

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

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

next

for n = 1 to len(wordList)

   flag = 1
   str = wordList[n]
   stra = count(str,"a")
   stre = count(str,"e")
   stri = count(str,"i")
   stro = count(str,"o")
   stru = count(str,"u")
   strtmp = [stra,stre,stri,stro,stru]
   ln = len(strtmp)
   for m = 1 to ln
       if strtmp[m] != 1
          flag = 0
          exit
       ok
   next
   if flag = 1
      num = num + 1
      see "" + num + ". " + wordList[n] + nl
   ok

next

see "done..." + nl

func count(cString,dString)

    sum = 0
    while substr(cString,dString) > 0
          sum = sum + 1
          cString = substr(cString,substr(cString,dString)+len(string(sum)))
    end
    return sum

</lang>

Output:
working...
1. ambidextrous
2. bimolecular
3. cauliflower
4. communicable
5. communicate
6. consanguine
7. consultative
8. countervail
9. exclusionary
10. grandiloquent
11. importunate
12. incommutable
13. incomputable
14. insupportable
15. loudspeaking
16. malnourished
17. mensuration
18. oneupmanship
19. pandemonium
20. permutation
21. perturbation
22. portraiture
23. praseodymium
24. stupefaction
25. sulfonamide
done...