Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
11-liner: had to assign consonants and vowels a sign number solution in Clear category for Striped Words by Stensen
from re import split
letters = {**{char: 1 for char in 'bcdfghjklmnpqrstvwxyz'}, **{char: 0 for char in 'aoeiuy'}}
def is_striped(word):
chunk = word[0]
for char in word[1:]:
if letters[chunk[-1]] == letters[char]: return False
chunk = char
return True
def checkio(t):
words = filter(lambda i: i and len(i) > 1 and i.isalpha(), split(r'[ :,.?]', t.lower()))
return [is_striped(word) for word in words].count(True)
Oct. 28, 2020