I checked the editorial but didnt get the logic

please help with soln

This is a question of a special data structure i.e Trie. One time please see the video of Trie and try to solve easy question and then do this question. You will able to do this.

sorry still didnt get it please help

showing segmentation fault

@chemant077,
You are trying to access data member in a NULL pointer at line 108. Please dry run using the given sample input.

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.