I get,
4 ['csch'] abbreviation for hyperbolic cosecant, so this does not count
5 ['angst', 'crwth', 'schmo', 'schwa']
A crwth is a Welsh stringed musical instrument
17 ['anthracosilicosis', 'anthropogeography', 'anthropomorphosis', 'methylnaphthalene']
------------
The variable "words" is a list of about 47,000 words
w4inarow = [[] for i in range(50)]
consonants = 'bcdfghjklmnpqrstvwxz'
w4len = [0 for i in range(50)]
for w in words:
concount = 0
vowel = True
for c in w:
if vowel and c in consonants:
concount = 1
vowel = False
elif not vowel and c in consonants:
concount += 1
vowel = False
elif c not in consonants:
concount = 0
vowel = True
if concount >= 4:
w4inarow[len(w)].append(w)
w4len[len(w)] += 1
continue
for i in range(4,0,-1):
if len(w4inarow[i]) > 0:
print(i,w4inarow[i])
break
for i in range(5,0,-1):
if len(w4inarow[i]) > 0:
print(i,w4inarow[i])
break
for i in range(49,0,-1):
if len(w4inarow[i]) > 0:
print(i,w4inarow[i])
break
|
Posted by Larry
on 2023-08-20 11:42:19 |