Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Striped Words by UFO665
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def isStriped(word):
if len(word) < 2 or any(char.isdigit() for char in word):
return False
nextChar = None
for char in word:
if nextChar and char not in nextChar:
return False
nextChar = CONSONANTS if char in VOWELS else VOWELS
return True
def checkio(text):
newText = "".join(char if char in VOWELS + CONSONANTS or char.isdigit() else " " for char in text.upper())
return sum(int(isStriped(word)) for word in newText.split())
Jan. 25, 2016
Comments: