Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
search for unstriped words solution in Clear category for Striped Words by kskkskksk
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def checkio(text):
import re
"""make a list with separated words by punctuations
and remove single-letter words and empty strings"""
input_words = [word for word in re.split("[\s\.\?\!,]", text.upper())
if word.isalpha() and len(word) >= 2]
"""search for not-striped words and -1 each time"""
output_num = len(input_words)
for word in input_words:
if re.search("([{v}][{v}])|([{c}][{c}])".format(
v = VOWELS, c = CONSONANTS), word):
output_num -= 1
return output_num
April 13, 2015