RPDRDNG-Help Needed

[RPDRDNG]

(CodeChef: Practical coding for everyone)
Can some one please help me in finding the case i am missing.

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

Earlier i had read the problem wrong thinking that each of the prefix and suffix are placed in a particular order so had created an array denoting its position but later i realized i just needed to count the number of occurrences. I made the said changes but i am failing some cases.