VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def checkio(text):
import string
text = ''.join([' ' if char in string.punctuation else char for char in text ])
words = text.split()
return sum([checkword(word) if word.isalpha() else 0 for word in words])
def checkword(word):
if len(word) == 1 :return 0
return 1 if all([True if (word[i].upper() in VOWELS and word[i + 1].upper() in CONSONANTS) or (word[i + 1].upper() in VOWELS and word[i].upper() in CONSONANTS) else False for i in range(len(word)-1)]) else 0