Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Striped Words by TovarischZhukov
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
SPLITTERS = " .,;!?"
def find(elem):
if elem[0].isdigit(): return False
isVolwes = elem[0] in VOWELS
for val in elem[1:]:
if val.isdigit(): return False
if isVolwes:
if val not in CONSONANTS: return False
isVolwes = False
else:
if val not in VOWELS: return False
isVolwes = True
return True
def checkio(data):
data = data.upper()
vv=[]
pos = 0
count = 0
for i, elem in enumerate(data):
val = data[pos:i].strip()
if elem in SPLITTERS:
if len(val)>1:
vv.append(val)
pos = i+1
val = data[pos:i].strip()
if len(val)>1:
vv.append(val)
for elem in vv:
if find(elem):
count+=1
return count
Dec. 6, 2015