Find words which contains all the vowels: Difference between revisions

m
(J)
m (→‎{{header|Wren}}: Minor tidy)
 
(18 intermediate revisions by 9 users not shown)
Line 13:
 
=={{header|11l}}==
<langsyntaxhighlight lang="11l">L(word) File(‘unixdict.txt’).read().split("\n")
I word.len > 10
L(vowel) (‘a’, ‘e’, ‘i’, ‘o’, ‘u’)
Line 19:
L.break
L.was_no_break
print(word)</langsyntaxhighlight>
 
{{out}}
Line 52:
=={{header|Action!}}==
In the following solution the input file [https://gitlab.com/amarok8bit/action-rosetta-code/-/blob/master/source/unixdict.txt unixdict.txt] is loaded from H6 drive. Altirra emulator automatically converts CR/LF character from ASCII into 155 character in ATASCII charset used by Atari 8-bit computer when one from H6-H10 hard drive under DOS 2.5 is used.
<langsyntaxhighlight Actionlang="action!">BYTE FUNC Once(CHAR ARRAY text CHAR c)
BYTE i,n
 
Line 105:
 
FindWords(fname)
RETURN</langsyntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Find_words_which_contains_all_the_vowels.png Screenshot from Atari 8-bit computer]
Line 115:
 
=={{header|Ada}}==
<langsyntaxhighlight Adalang="ada">with Ada.Text_Io;
with Ada.Strings.Maps;
with Ada.Strings.Fixed;
Line 146:
end loop;
Close (File);
end Find_All_Vowels;</langsyntaxhighlight>
 
=={{header|ALGOL 68}}==
<langsyntaxhighlight lang="algol68"># find 11 or more character words that contain all the vowels once #
 
# read the list of words and look for suitable words #
Line 195:
OD;
close( input file )
FI</langsyntaxhighlight>
{{out}}
<pre>
Line 226:
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">words: read.lines relative "unixdict.txt"
vowels: ["a" "e" "i" "o" "u"]
containsAllVowels?: function [w][
Line 241:
print word
]
]</langsyntaxhighlight>
 
{{out}}
Line 272:
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight AutoHotkeylang="autohotkey">FileRead, db, % A_Desktop "\unixdict.txt"
vowels := ["a", "e", "i", "o", "u"]
main:
Line 287:
result .= word "`n"
}
MsgBox, 262144, , % result</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 316:
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f FIND_WORDS_WHICH_CONTAINS_ALL_THE_VOWELS.AWK unixdict.txt
{ if (length($0) <= 10) {
Line 329:
exit(0)
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 360:
 
=={{header|BASIC}}==
<langsyntaxhighlight lang="basic">10 DEFINT A-Z: DEFSTR C,W
20 OPEN "I",1,"UNIXDICT.TXT"
30 IF EOF(1) THEN CLOSE #1: END
Line 375:
140 NEXT N
150 IF A=1 AND E=1 AND I=1 AND O=1 AND U=1 THEN PRINT W,
160 GOTO 30</langsyntaxhighlight>
{{out}}
<pre>ambidextrous bimolecular cauliflower communicable communicate
Line 384:
 
=={{header|BCPL}}==
<langsyntaxhighlight lang="bcpl">get "libhdr"
 
let reads(v) = valof
Line 416:
while reads(word) if testword(word) do writef("%S*N", word)
endread()
$)</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 443:
stupefaction
sulfonamide</pre>
 
=={{header|C}}==
<syntaxhighlight lang="c">
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
 
/* "Use the dictionary unixdict.txt" */
#define DICTIONARY_FILE_NAME "unixdict.txt"
 
/* "The length of any word shown should be >10" */
#define MIN_WORD_LENGTH 11
 
 
char *create_word_buffer( const char *file_name, size_t *buffer_size );
int verify_vowels( const char *word, size_t word_length );
int wait_for_return( void );
 
 
int main() {
size_t buffer_size = 0;
char *buffer = create_word_buffer( DICTIONARY_FILE_NAME, &buffer_size );
 
if( buffer ) {
FILE *f = fopen( DICTIONARY_FILE_NAME, "r" );
 
if( f ) {
while( fgets(buffer,buffer_size,f) ) {
size_t l = strlen( buffer );
if( '\n'==buffer[l-1] ) buffer[--l] = '\0';
 
if( l>=MIN_WORD_LENGTH && verify_vowels(buffer,l) ) {
printf( "%s\n", buffer );
}
}
 
fclose( f ); f = NULL; /* cleanup */
} else puts( "Couldn't open dictionary file." );
 
free( buffer ); buffer = NULL; /* cleanup */
} else puts( "Couldn't create word buffer." );
 
return wait_for_return();
}
 
 
/*==============================================================================
No need to verify any parameters in any of the following function - the caller
did his homeworks.
==============================================================================*/
 
 
size_t get_line_length( FILE *f ) {
size_t line_length = 0;
int c, ok;
 
do {
c = fgetc(f);
ok = '\n'!=c&&EOF!=c;
line_length += ok;
} while( ok );
 
return line_length;
}
 
 
size_t find_longest_line_in_file( const char *file_name ) {
size_t max_line_length = ((size_t)-1);
 
FILE *f = fopen( file_name, "r" );
 
if( f ) {
max_line_length = 0;
 
while( !feof(f) ) {
size_t line_length = get_line_length( f );
 
if( line_length>max_line_length )
max_line_length = line_length;
}
 
fclose( f ); f = NULL;
}
 
return max_line_length;
}
 
 
char *create_word_buffer( const char *file_name, size_t *buffer_size ) {
char *buffer = NULL;
 
size_t max_line_length = find_longest_line_in_file( file_name );
 
if( ((size_t)-1)!=max_line_length ) {
buffer = calloc( max_line_length+2, sizeof(*buffer) );
if( buffer ) *buffer_size = max_line_length+2;
}
 
return buffer;
}
 
 
int verify_vowels( const char *word, size_t word_length ) {
int vowel_instances[5] = {0};
size_t i;
 
for( i=0; i<word_length; ++i ) {
switch( word[i] ) {
case 'A': case 'a': vowel_instances[0]++; break;
case 'E': case 'e': vowel_instances[1]++; break;
case 'I': case 'i': vowel_instances[2]++; break;
case 'O': case 'o': vowel_instances[3]++; break;
case 'U': case 'u': vowel_instances[4]++; break;
default: ;
}
}
 
return 1==vowel_instances[0] &&
1==vowel_instances[1] &&
1==vowel_instances[2] &&
1==vowel_instances[3] &&
1==vowel_instances[4];
}
 
 
int wait_for_return( void ) {
puts( "\nPress Return to exit... " );
while( '\n'!=getchar() );
return 0;
}
</syntaxhighlight>
 
{{out}}
<pre>
ambidextrous
bimolecular
cauliflower
communicable
communicate
consanguine
consultative
countervail
exclusionary
grandiloquent
importunate
incommutable
incomputable
insupportable
loudspeaking
malnourished
mensuration
oneupmanship
pandemonium
permutation
perturbation
portraiture
praseodymium
stupefaction
sulfonamide
 
Press Return to exit...
</pre>
 
=={{header|C++}}==
<langsyntaxhighlight lang="cpp">#include <bitset>
#include <cctype>
#include <cstdlib>
Line 486 ⟶ 649:
}
return EXIT_SUCCESS;
}</langsyntaxhighlight>
 
{{out}}
Line 518 ⟶ 681:
 
=={{header|CLU}}==
<langsyntaxhighlight lang="clu">has_all_vowels_once = proc (s: string) returns (bool)
vowels: string := "aeiou"
vowel_counts: array[int] := array[int]$fill(1,string$size(vowels),0)
Line 547 ⟶ 710:
stream$close(fstream)
end
end start_up</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 576 ⟶ 739:
 
=={{header|COBOL}}==
<langsyntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. ALL-VOWELS.
Line 620 ⟶ 783:
IF LEN IS GREATER THAN 10
AND 1 IS EQUAL TO A AND E AND I AND O AND U,
DISPLAY WORD.</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 650 ⟶ 813:
=={{header|Common Lisp}}==
 
<langsyntaxhighlight lang="lisp">(defun print-words (file-name word-length vowels vowels-number)
(with-open-file (dictionary file-name :if-does-not-exist nil)
(loop for word = (read-line dictionary nil nil)
Line 660 ⟶ 823:
(write-line word))))
 
(print-words "unixdict.txt" 10 "aeiou" 1)</langsyntaxhighlight>
 
=={{header|Delphi}}==
{{libheader| System.SysUtils}}
{{libheader| System.IoUtils}}
<syntaxhighlight lang="delphi">
<lang Delphi>
program Find_words_which_contains_all_the_vowels;
 
Line 717 ⟶ 880:
 
readln;
end.</langsyntaxhighlight>
{{out}}
<pre> 1: ambidextrous
Line 746 ⟶ 909:
 
=={{header|Draco}}==
<langsyntaxhighlight lang="draco">\util.g
 
proc all_vowels(*char line) bool:
Line 789 ⟶ 952:
close(dict)
corp</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 818 ⟶ 981:
 
=={{header|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">
// Words which containing all the vowels once . Nigel Galloway: February 17th., 2021
let fN g=if String.length g < 11 then false else let n=Map.ofSeq (Seq.countBy id g) in let fN g=n.ContainsKey g && n.[g]=1 in fN 'a' && fN 'i' && fN 'o' && fN 'u' && fN 'e'
seq{use n=System.IO.File.OpenText("unixdict.txt") in while not n.EndOfStream do yield n.ReadLine()}|>Seq.filter fN|>Seq.iter(printfn "%s")
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 853 ⟶ 1,016:
 
=={{header|Factor}}==
<langsyntaxhighlight lang="factor">USING: grouping io.encodings.ascii io.files math prettyprint
sequences sets.extras ;
 
Line 859 ⟶ 1,022:
[ length 10 > ] filter
[ non-repeating "aeiou" superset? ] filter
5 group simple-table.</langsyntaxhighlight>
{{out}}
<pre>
Line 871 ⟶ 1,034:
=={{header|Forth}}==
{{works with|Gforth}}
<langsyntaxhighlight lang="forth">: contains-all-vowels-once ( addr u -- ? )
0 { vowels }
0 do
Line 920 ⟶ 1,083:
 
main
bye</langsyntaxhighlight>
 
{{out}}
Line 952 ⟶ 1,115:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">dim as boolean v(1 to 5)
dim as string s, c, q(1 to 5) = {"a","e","i","o","u"}
dim as integer i, j, n
Line 981 ⟶ 1,144:
 
close #1
</syntaxhighlight>
</lang>
{{out}}<pre>
ambidextrous
Line 1,011 ⟶ 1,174:
 
=={{header|Frink}}==
<langsyntaxhighlight lang="frink">for word = select[lines["https://web.archive.org/web/20180611003215if_/http://www.puzzlers.org:80/pub/wordlists/unixdict.txt"], {|x| length[x] > 10}]
{
d = countToDict[charList[word]]
if d@"a" == 1 and d@"e" == 1 and d@"i" == 1 and d@"o" == 1 and d@"u" == 1
println[word]
}</langsyntaxhighlight>
{{out}}
<pre>
ambidextrous
bimolecular
cauliflower
communicable
communicate
consanguine
consultative
countervail
exclusionary
grandiloquent
importunate
incommutable
incomputable
insupportable
loudspeaking
malnourished
mensuration
oneupmanship
pandemonium
permutation
perturbation
portraiture
praseodymium
stupefaction
sulfonamide
</pre>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
 
#plist NSAppTransportSecurity @{NSAllowsArbitraryLoads:YES}
 
local fn Words as CFArrayRef
CFURLRef url = fn URLWithString( @"http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" )
CFStringRef string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
CFArrayRef array = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet )
PredicateRef predicate = fn PredicateWithFormat( @"self.length > %d", 10 )
end fn = fn ArrayFilteredArrayUsingPredicate( array, predicate )
 
void local fn DoIt
CFArrayRef words = fn Words
CFStringRef wd
for wd in words
long index, a = 0, e = 0, i = 0, o = 0, u = 0
for index = 0 to len(wd) - 1
select ( fn StringCharacterAtIndex( wd, index ) )
case _"a" : a++
case _"e" : e++
case _"i" : i++
case _"o" : o++
case _"u" : u++
end select
next
if ( a == 1 and e == 1 and i == 1 and o == 1 and u == 1 )
print wd
end if
next
end fn
 
fn DoIt
 
HandleEvents
</syntaxhighlight>
 
{{out}}
<pre>
Line 1,047 ⟶ 1,277:
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
 
import (
Line 1,094 ⟶ 1,324:
}
}
}</langsyntaxhighlight>
 
{{out}}
Line 1,127 ⟶ 1,357:
</pre>
 
=={{header|Haskell}}==
<syntaxhighlight lang="haskell">
condition :: String -> Bool
condition s = all (\vow -> count vow s == 1 ) "aeiou"
where
count :: Char -> String -> Int
count letter word = length $ filter ( == letter ) word
 
main :: IO ( )
main = do
theLines <- readFile "unixdict.txt"
let selected = filter condition $ words theLines
mapM_ putStrLn selected</syntaxhighlight>
 
{{out}}
(with my version of unixdict.txt)
<pre>
ambidextrous
aureomycin
bimolecular
cauliflower
colatitude
communicable
communicate
consanguine
consultative
countervail
dalhousie
denudation
deputation
dialogue
equivocal
euphorbia
euphoria
exclusionary
exhaustion
exhumation
exudation
exultation
facetious
fluoridate
gelatinous
grandiloquent
gregarious
houdaille
importunate
incommutable
incomputable
inoculate
insupportable
loudspeaking
malnourished
mendacious
mensuration
oneupmanship
pandemonium
permutation
persuasion
perturbation
pneumonia
portraiture
praseodymium
precarious
precaution
quasiorder
refutation
reputation
sequoia
stupefaction
sulfonamide
tambourine
tenacious
veracious
vexatious
</pre>
 
or, adding the restriction to words of more than 10 characters, and using Data.Set to identify words with a set of 5 unique vowel characters, which have no more than 5 vowel characters in total:
 
<syntaxhighlight lang="haskell">import Data.Set (Set, fromList, member, size)
 
---- WORDS OVER 10 CHARS WHICH CONTAIN EACH VOWEL ONCE ---
 
p :: String -> Bool
p = ((&&) . (10 <) . length) <*> eachVowelOnce
 
eachVowelOnce :: String -> Bool
eachVowelOnce w =
all (5 ==) $
[length, size . fromList] <*> [filter (`member` vowels) w]
 
vowels :: Set Char
vowels = fromList "aeiou"
 
--------------------------- TEST -------------------------
main :: IO ()
main =
readFile "unixdict.txt"
>>= (mapM_ putStrLn . filter p . lines)</syntaxhighlight>
{{Out}}
<pre>ambidextrous
bimolecular
cauliflower
communicable
communicate
consanguine
consultative
countervail
exclusionary
grandiloquent
importunate
incommutable
incomputable
insupportable
loudspeaking
malnourished
mensuration
oneupmanship
pandemonium
permutation
perturbation
portraiture
praseodymium
stupefaction
sulfonamide</pre>
 
=={{header|J}}==
<langsyntaxhighlight Jlang="j"> >(#~ ((]-:&(/:~)([-.-.))&'aeiou' * 10 <#)@>) cutLF fread 'unixdict.txt'
ambidextrous
bimolecular
Line 1,154 ⟶ 1,508:
praseodymium
stupefaction
sulfonamide</langsyntaxhighlight>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight lang="jq">
<lang jq>
select(length > 10)
| . as $w
| select( all("a","e","i","o","u";
. as $v | ($w | test($v) and (test( "\($v).*\($v)")|not))))
</syntaxhighlight>
</lang>
{{out}}
Invocation example: jq -Rr -f program.jq unixdict.txt
Line 1,179 ⟶ 1,533:
=={{header|Julia}}==
See [[Alternade_words]] for the foreachword function.
<langsyntaxhighlight lang="julia">hassallthevowels(w, d) = all(c -> count(x -> x == c, w) == 1, collect("aeiou")) ? w : ""
foreachword("unixdict.txt", hassallthevowels, colwidth=18, minlen=11, numcols=5)
</langsyntaxhighlight>{{out}}<pre>
Word source: unixdict.txt
 
Line 1,192 ⟶ 1,546:
 
=={{header|Ksh}}==
<langsyntaxhighlight lang="ksh">
#!/bin/ksh
 
Line 1,225 ⟶ 1,579:
_allvowels "$REPLY"
(( $? )) && print "$((++i)). $REPLY"
done < ${dict}</langsyntaxhighlight>
{{out}}<pre>1. ambidextrous
2. bimolecular
Line 1,253 ⟶ 1,607:
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">vowels=Characters["euioa"];
dict=Once[Import["https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt"]];
dict//=StringSplit[#,"\n"]&;
Line 1,260 ⟶ 1,614:
dict//=Select[Last/*DuplicateFreeQ];
dict//=Select[Last/*Length/*EqualTo[Length[vowels]]];
dict[[All,1]]</langsyntaxhighlight>
{{out}}
<pre>{ambidextrous, bimolecular, cauliflower, communicable, communicate, consanguine, consultative, countervail, exclusionary, grandiloquent, importunate, incommutable, incomputable, insupportable, loudspeaking, malnourished, mensuration, oneupmanship, pandemonium, permutation, perturbation, portraiture, praseodymium, stupefaction, sulfonamide}</pre>
 
=={{header|Modula-2}}==
<langsyntaxhighlight lang="modula2">MODULE Vowels;
IMPORT SeqIO;
IMPORT Texts;
Line 1,311 ⟶ 1,665:
ts := Texts.Disconnect(dict);
fs := SeqIO.Close(file);
END Vowels.</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 1,340 ⟶ 1,694:
 
=={{header|Nim}}==
<langsyntaxhighlight Nimlang="nim">import strutils
 
const Vowels = ['a', 'e', 'i', 'o', 'u']
Line 1,352 ⟶ 1,706:
break checkWord
inc count
stdout.write word.align(15), if count mod 5 == 0: '\n' else: ' '</langsyntaxhighlight>
 
{{out}}
Line 1,362 ⟶ 1,716:
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict;
Line 1,368 ⟶ 1,722:
 
@ARGV = 'unixdict.txt';
length > 11 and !/([aeiou]).*\1/ and tr/aeiou// == 5 and print while <>;</langsyntaxhighlight>
{{out}}
ambidextrous
Line 1,397 ⟶ 1,751:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">onev</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">word</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">vowel</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">find_all</span><span style="color: #0000FF;">(</span><span style="color: #000000;">vowel</span><span style="color: #0000FF;">,</span><span style="color: #000000;">word</span><span style="color: #0000FF;">))=</span><span style="color: #000000;">1</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
Line 1,403 ⟶ 1,757:
<span style="color: #004080;">sequence</span> <span style="color: #000000;">fivev</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">filter</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">unix_dict</span><span style="color: #0000FF;">(),</span><span style="color: #000000;">allv</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d words: %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">fivev</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">shorten</span><span style="color: #0000FF;">(</span><span style="color: #000000;">fivev</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">))})</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 1,410 ⟶ 1,764:
 
=={{header|PL/I}}==
<langsyntaxhighlight lang="pli">allTheVowels: procedure options(main);
countChar: procedure(str, ch) returns(fixed);
declare str char(32) varying, ch char, (i, n) fixed;
Line 1,437 ⟶ 1,791:
end;
end;
end allTheVowels;</langsyntaxhighlight>
{{out}}
<pre>ambidextrous
Line 1,467 ⟶ 1,821:
=={{header|Python}}==
Tested on Python 3+, the file download will work only if the link is still active. It is possible that you may be able to fetch the file in your browser but download via code may still fail. Check whether you are connected to a VPN, it works on open networks.
<syntaxhighlight lang="python">
<lang Python>
import urllib.request
from collections import Counter
Line 1,484 ⟶ 1,838:
if frequency['a']==frequency['e']==frequency['i']==frequency['o']==frequency['u']==1:
print(word)
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 1,513 ⟶ 1,867:
sulfonamide
</pre>
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="Quackery"> [ [] swap ]'[ swap
witheach
[ dup nested
unrot over do
iff [ dip join ]
else nip ]
drop ] is filter ( [ --> [ )
 
[ 2dup peek
1+ unrot poke ] is pink ( [ n --> [ )
 
[ ' [ 0 0 0 0 0 0 ]
swap witheach
[ lower
$ "aeiou" find
pink ]
-1 split drop
' [ 1 1 1 1 1 ] = ] is valid ( [ --> b )
 
$ "rosetta/unixdict.txt" sharefile drop nest$
filter [ size 10 > ]
filter valid
70 wrap$</syntaxhighlight>
 
{{out}}
 
<pre>ambidextrous bimolecular cauliflower communicable communicate
consanguine consultative countervail exclusionary grandiloquent
importunate incommutable incomputable insupportable loudspeaking
malnourished mensuration oneupmanship pandemonium permutation
perturbation portraiture praseodymium stupefaction sulfonamide</pre>
 
=={{header|R}}==
Adapting this from https://rosettacode.org/wiki/Find_words_which_contain_the_most_consonants#R is trivial.
<langsyntaxhighlight lang="rsplus">dict <- scan("https://web.archive.org/web/20180611003215/http://www.puzzlers.org/pub/wordlists/unixdict.txt", what = character())
dictBig <- dict[nchar(dict) > 10]
#The following line is equivalent to sapply(c("a", "e", "i", "o", "u"), function(x) stringr::str_count(dictBig, x))
#As with all things with strings in R, life is easier with stringr or stringi.
vowelCount <- sapply(c("a", "e", "i", "o", "u"), function(x) lengths(regmatches(dictBig, gregexec(x, dictBig))))
dictBig[apply(vowelCount, MARGIN = 1, function(x) all(x == 1))]</langsyntaxhighlight>
 
=={{header|Raku}}==
Yet another "Filter a word list" task.
 
<syntaxhighlight lang="raku" perl6line>put +.words, " words found:\n", $_ with 'unixdict.txt'.IO.words\
.grep({ .chars > 10 and all(.comb.Bag<a e i o u>) == 1 })\
.batch(5)».fmt('%-13s').join: "\n";</langsyntaxhighlight>
 
{{out}}
Line 1,539 ⟶ 1,927:
 
=={{header|Red}}==
<langsyntaxhighlight lang="rebol">Red[]
 
vowels: charset "aeiou"
Line 1,562 ⟶ 1,950:
print word
]
]</langsyntaxhighlight>
{{out}}
<pre>
Line 1,598 ⟶ 1,986:
They also allows the minimum length to be specified on the command line (CL) as well as the dictionary file identifier.
=== version 1 ===
<langsyntaxhighlight lang="rexx">/*REXX pgm finds all words that contain only one vowel each (no duplication of vowels). */
parse arg minL iFID . /*obtain optional arguments from the CL*/
if minL=='' | minL=="," then minL= 11 /*Not specified? Then use the default.*/
Line 1,626 ⟶ 2,014:
/*stick a fork in it, we're all done. */
say copies('─',30) finds ' words found with only one each of every vowel,' ,
" and with a minimum length of " minL</langsyntaxhighlight>
{{out|output|text=&nbsp; when using the internal default input:}}
<pre>
Line 1,661 ⟶ 2,049:
=== version 2 ===
This REXX version uses the &nbsp; '''countstr''' &nbsp; BIF which returns the count of (a particular) character in a string.
<langsyntaxhighlight lang="rexx">/*REXX pgm finds all words that contain only one vowel each (no duplication of vowels). */
parse arg minL iFID . /*obtain optional arguments from the CL*/
if minL=='' | minL=="," then minL= 11 /*Not specified? Then use the default.*/
Line 1,688 ⟶ 2,076:
/*stick a fork in it, we're all done. */
say copies('─',30) finds ' words found with only one each of every vowel,' ,
" and with a minimum length of " minL</langsyntaxhighlight>
{{out|output|text=&nbsp; is identical to the 1<sup>st</sup> REXX version.}} <br><br>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
load "stdlib.ring"
 
Line 1,741 ⟶ 2,129:
end
return sum
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 1,772 ⟶ 2,160:
done...
 
</pre>
 
=={{header|RPL}}==
The only way to use <code>unixdict.txt</code> as input is to convert it into a list of 25104 strings. Fortunately, emulators can handle such a big data structure in RAM.
{{works with|Halcyon Calc|4.2.7}}
≪ { }
1 UnixDict SIZE '''FOR''' j
'UnixDict' j GET
'''IF''' DUP SIZE 10 < '''THEN''' DROP '''ELSE'''
{ 5 } 0 CON
1 3 PICK SIZE '''FOR''' j
OVER j DUP SUB
'''IF''' "AEIOUaeiou" SWAP POS '''THEN'''
LAST 1 - 5 MOD 1 +
DUP2 GET 1 + PUT
'''END'''
'''NEXT'''
'''IF''' [ 1 1 1 1 1 ] == '''THEN''' + '''ELSE''' DROP '''END'''
'''END NEXT'''
» '<span style="color:blue">AEIOU</span>' STO
 
{{out}}
<pre>
1: { "ambidextrous" "aureomycin" "bimolecular" "cauliflower" "colatitude" "communicable" "communicate" "consanguine" "consultative" "countervail" "denudation" "deputation" "exclusionary" "exhaustion" "exhumation" "exultation" "fluoridate" "gelatinous" "grandiloquent" "gregarious" "importunate" "incommutable" "incomputable" "insupportable" "loudspeaking" "malnourished" "mendacious" "mensuration" "oneupmanship" "pandemonium" "permutation" "persuasion" "perturbation" "portraiture" "praseodymium" "precarious" "precaution" "quasiorder" "refutation" "reputation" "stupefaction" "sulfonamide" "tambourine" }
</pre>
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">File.open("unixdict.txt").each(chomp: true) do |word|
puts word if word.size > 10 && word.chars.tally.values_at('a','e','i','o','u').all?(1)
end
</syntaxhighlight>
</lang>
{{out}}
<pre>ambidextrous
Line 1,806 ⟶ 2,218:
sulfonamide
</pre>
 
=={{header|sed}}==
<syntaxhighlight lang="sed">#!/bin/sed -f
 
/^.\{11\}/!d
/^[^a]*a[^a]*$/!d
/^[^e]*e[^e]*$/!d
/^[^i]*i[^i]*$/!d
/^[^o]*o[^o]*$/!d
/^[^u]*u[^u]*$/!d</syntaxhighlight>
 
=={{header|Swift}}==
<langsyntaxhighlight lang="swift">import Foundation
 
func containsAllVowelsOnce(_ word: String) -> Bool {
Line 1,847 ⟶ 2,269:
} catch {
print(error.localizedDescription)
}</langsyntaxhighlight>
 
{{out}}
Line 1,880 ⟶ 2,302:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<langsyntaxhighlight ecmascriptlang="wren">import "io" for File
import "./fmt" for Fmt
 
var wordList = "unixdict.txt" // local copy
Line 1,894 ⟶ 2,316:
count = count + 1
Fmt.print("$2d: $s", count, w)
}</langsyntaxhighlight>
 
{{out}}
Line 1,926 ⟶ 2,348:
 
=={{header|XPL0}}==
<langsyntaxhighlight XPL0lang="xpl0">string 0; \Use zero-terminated strings
int I, Ch, Len;
char Word(100); \(longest word in unixdict.txt is 22 chars)
Line 1,958 ⟶ 2,380:
if AllVowels then [Text(0, Word); CrLf(0)];
until Ch = EOF;
]</langsyntaxhighlight>
 
{{out}}
9,482

edits