Facing some problem with the code

Please help to debug the code.

Follow these steps:

  1. Make a trie containing characters of strings.
  2. For each word in query first go till the end char of this word in trie and then push all words that can be made using chars in the subtree of this last char and sort these words in lexiographical order and print it.