Segmentation fault

https://ide.geeksforgeeks.org/DZCL8TRm8X
i am getting segmentation fault . This question is based on trie data structure.
input:-
1
3
abc
ab
abd
ab

Learning to debug things for yourself is an invaluable skill, but as a hint … “root” in main always stays as nullptr, and a call to search(…) will attempt to de-reference “root”, and de-referencing a null pointer (and attempting to make use of it) is undefined behaviour.

2 Likes