Sheokand and String june 2018 long

Above is the link to the problem

https://www.codechef.com/viewsolution/18863280

Above is the solution for the problem. I dont know why it is giving SIGSEV. It runs perfectly on my local machine. The implementation is that of Trie data structure. Please help.