Find words which contain the most consonants: Difference between revisions
Find words which contain the most consonants (view source)
Revision as of 06:08, 14 December 2021
, 2 years agoadd FreeBASIC
(Added solution for Action!) |
(add FreeBASIC) |
||
Line 1,145:
}
</pre>
=={{header|FreeBASIC}}==
<lang freebasic>
function uniq_cons( s as string ) as integer
dim letter( 1 to 26 ) as boolean
dim as uinteger n, i
dim as string*1 c
for i = 1 to len(s)
c = lcase(mid(s,i,1))
if c = "a" or c = "e" or c = "i" or c = "o" or c = "u" then continue for
if letter(asc(c)-97)=true then return 0
letter(asc(c)-97)=true
n+=1
next i
return n
end function
dim as string ln
dim as integer u
open "unixdict.txt" for input as #1
while not eof(1)
line input #1, ln
if len(ln)<11 then continue while
u=uniq_cons(ln)
if u>0 then print ln;": ";u;" distint consonants"
wend
close #1</lang>
=={{header|Go}}==
|