Help needed in CHEFSHIP

Can someone please tell why my Solution is giving the wrong answer. I have used the same approach as used in the setter’s solution. I have used KMP to calculate lps array.

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

Any help would be appreciated