dp for all the prefix of the string
using trie to check whether a string is a substr of another string.