Find words which contains all the vowels: Difference between revisions
Find words which contains all the vowels (view source)
Revision as of 19:06, 16 December 2021
, 2 years agono edit summary
(Added solution for Action!) |
No edit summary |
||
Line 873:
perturbation portraiture praseodymium stupefaction sulfonamide
</pre>
=={{header|Ksh}}==
<lang ksh>
#!/bin/ksh
# Find words which contains all the vowels
# # Variables:
#
dict='../unixdict.txt'
integer MINLENGTH=10
typeset -a vowels=( a e i o u )
# # Functions:
#
# # Function _allvowels(str) - return 1 if str contains all 5 vowels
#
function _allvowels {
typeset _str ; typeset -l _str="$1"
typeset _i ; integer _i
for ((_i=0; _i<${#vowels[*]}; _i++)); do
[[ ${_str} != *+(${vowels[_i]})* ]] && return 0
[[ ${_str/${vowels[_i]}/} == *+(${vowels[_i]})* ]] && return 0
done
return 1
}
######
# main #
######
integer i=0
while read; do
(( ${#REPLY} <= MINLENGTH )) && continue
_allvowels "$REPLY"
(( $? )) && print "$((++i)). $REPLY"
done < ${dict}</lang>
{{out}}<pre>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</pre>
=={{header|Mathematica}}/{{header|Wolfram Language}}==
|