Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Words Order by Pouf
def words_order(text: str, words: list) -> bool:
if len(set(words)) != len(words):
return False
try:
word_order = [text.split().index(word) for word in words]
except ValueError:
return False
return word_order == sorted(word_order)
June 28, 2020