Giving a string and an string dictionary, find the longest string in dictionary which can formed by deleting some characters of the giving string.
Example:
S = abpcplea,
Dict = {ale, apple, monkey, plea},
the return "apple"
Can somebody provide trie solution( O(N*K) ), N: length of string, K: length of longest word?