Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Striped Words by nikita.marchenko
# migrated from python 2.7
def checkio(data):
result = ""
for d in data.upper():
if d in 'AEIOUY':
result += '0'
elif d in 'BCDFGHJKLMNPQRSTVWXZ':
result += '1'
elif d.isdigit():
result += 'X'
else:
result += '_'
import re
return len([x for x in result.split('_') if len(x) > 1 and not re.search('X|00|11', x)])
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("My name is ...") == 2, "All words are striped"
assert checkio("Hello world") == 0, "No one"
assert checkio("A quantity of striped words.") == 1, "Only of"
assert checkio("Dog,cat,mouse,bird.Human.") == 3, "Dog, cat and human"
Oct. 19, 2013
Comments: