I am not able to solve this question can you provide me code

sir please can you provide me code . i am able to solve this question

can’t provide the code but can explain the solution approach. Build a trie of all the strings given to you at the starting. Now, for every string that you query, search it in the trie and if it reaches some node of your trie successfully, that means there is at least one word that is present as an answer. Now , start moviing down the trie from that node till you hit a leaf and every time you encounter a end of word, just print the string. The other case, just add the string to your trie.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.