LearnPy Hub
← Arena
AdvancedRating 1500

Break Into Words

Print YES if the text can be split into a sequence of dictionary words (reuse allowed).

Input

The text, then a line of dictionary words.

Output

YES or NO.

Sample 1

Input
leetcode
leet code
Output
YES

Sample 2

Input
applepenapple
apple pen
Output
YES
solution.py
Output appears here
Break Into Words · Python Arena problem · LearnPy Hub