Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
7-liner: sets solution in Clear category for Words Order by przemyslaw.daniel
def words_order(text: str, words: list) -> bool:
# check if all words are in text
if set(words) - set(text.split()):
return False
# sort unique and check if they have the same order
return sorted(set(words), key=text.index) == words
March 6, 2020
Comments: