Can the text be split into words?

Write can_break(text, words) that returns whether text can be split into a sequence of words from the list words, with words reusable.

can_break("leetcode", ["leet", "code"])              ->  True
can_break("applepenapple", ["apple", "pen"])         ->  True
can_break("catsandog", ["cats", "dog", "sand", "and", "cat"])  ->  False

The point is to practise a DP over prefixes: a prefix is breakable if it ends with a word whose preceding prefix is breakable.

def can_break(text, words):
    ...