[Solved] [SHKSTR] - Help needed

Problem link: SHKSTR Problem - CodeChef
Submission link: CodeChef: Practical coding for everyone

I have been trying to solve this problem for the past 2 hours. My approach uses Trie + Offline queries. I am unable to find out what is causing \text{RTE}. Can someone help me figure it out? :pleading_face: