Microsoft Interview Question

Trie + string question + one DP + one stack