Given a string and a dictionary of words, determine whether the string can be segmented into a space-separated sequence of one or more dictionary words. Words may be reused any number of times.
Input:
- Line 1: the string (no spaces)
- Line 2: space-separated dictionary words
Output: Yes or No.