SHKSTR problem in editorial

I have used almost the same approach as the online one. Instead of a vector, i just stored the first occurence of the alphabet and another field which told me the index of the first word which ends there.
But, I am getting a TLE for it. Could you help me find why it is happening?
The link to my solution

Check the while loop in your find method

I think it’s alright because for every node there will exist an end having the same value as frstOcc in the subtree.