Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Striped Words by Kamyfator
import re
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def checkio(text):
text = text.upper()
tokens = re.split("[^A-Z0-9]+", text)
count = 0
for token in tokens:
if len(token) <= 1 or not token.isalpha():
continue
is_valid = True
for i in range(0, len(token)-1):
if VOWELS.find(token[i]) != -1 and VOWELS.find(token[i+1]) != -1:
is_valid = False
break
if CONSONANTS.find(token[i]) != -1 and CONSONANTS.find(token[i+1]) != -1:
is_valid = False
break
if is_valid:
count += 1
return count
Oct. 24, 2016