Find words which contain the most consonants: Difference between revisions

Added solution for Action!
(Added AutoHotkey)
(Added solution for Action!)
Line 11:
{{Template:Strings}}
<br><br>
 
=={{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.
<lang Action!>CHAR ARRAY line(256)
 
BYTE FUNC ConsonantsCount(CHAR ARRAY word)
BYTE len,i,c,count
BYTE ARRAY chars(128)
 
len=word(0)
IF len<=10 THEN RETURN (0) FI
 
SetBlock(chars,128,0)
count=0
FOR i=1 TO len
DO
c=word(i)
IF c#'a AND c#'e AND c#'i AND c#'o AND c#'u THEN
IF chars(c) THEN RETURN (0) FI
chars(c)=1
count==+1
FI
OD
RETURN (count)
 
BYTE FUNC FindMostConsonants(CHAR ARRAY fname)
BYTE max,count,dev=[1]
 
max=0
Close(dev)
Open(dev,fname,4)
WHILE Eof(dev)=0
DO
InputSD(dev,line)
count=ConsonantsCount(line)
IF max<count THEN
max=count
FI
OD
Close(dev)
RETURN (max)
 
PROC FindWords(CHAR ARRAY fname BYTE n)
BYTE count,dev=[1]
 
Close(dev)
Open(dev,fname,4)
WHILE Eof(dev)=0
DO
InputSD(dev,line)
count=ConsonantsCount(line)
IF count=n THEN
Print(line) Put(32)
FI
OD
Close(dev)
PutE() PutE()
RETURN
 
PROC Main()
CHAR ARRAY fname="H6:UNIXDICT.TXT"
BYTE i,max
 
PrintE("Finding the most consonants...")
PutE()
max=FindMostConsonants(fname)
 
i=max
WHILE i>=max-1
DO
PrintF("%B consonants:%E",i)
FindWords(fname,i)
i==-1
OD
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Find_words_which_contain_the_most_consonants.png Screenshot from Atari 8-bit computer]
<pre>
Finding the most consonants...
 
9 consonants:
comprehensible
 
8 consonants:
administrable anthropology blameworthy bluestocking boustrophedon bricklaying chemisorption christendom
claustrophobia compensatory comprehensive counterexample demonstrable disciplinary discriminable geochemistry
hypertensive indecipherable indecomposable indiscoverable lexicography manslaughter misanthropic mockingbird
monkeyflower neuropathology paralinguistic pharmacology pitchblende playwriting shipbuilding shortcoming
springfield stenography stockholder switchblade switchboard switzerland thunderclap
</pre>
 
=={{header|Ada}}==
Anonymous user