I have an interesting programming puzzle for you:
You will be given 2 things:
1. A word containing a list of english words put together :
word = "iamtiredareyou"
2. Possible subsets:
subsets = ['i', 'a', 'am', 'amt', 'm', 't', 'ti', 'tire', 'tired', 'i', 'ire', 'r', 're', 'red', 'redare', 'e', 'd', 'da', 'dar', 'dare', 'a', 'ar', 'are', 'r', 're', 'e', 'ey', 'y', 'yo', 'you', 'o', 'u']
Level 1 Challenge:
I need to programatically find the members in subsets which together in an order will make "iamtiredareyou" i.e. ['i', 'am', 'tired', 'are', 'you']
Level 2 Challenge
The original string may consist of some extra characters in sequence which are not present in the subset.
e.g. "iamtired12aareyou"
subset given is same as above, the solution should automatically include this subset in the right place in the result array.
i.e. ['i', 'am', 'tired', '12a', 'are', 'you']
How can I do this? Please provide code snippets in programming language of your choice.