I am getting **Wrong Answer** for my solution of this **problem** - http://www.codechef.com/problems/SSTORY/

**My solution** - http://www.codechef.com/viewsolution/5444288

My solution is working within time for large testcases that I generated and giving correct answer for small testcases. Can someone please help me find out some testcases where my solution is wrong or possible pitfalls in my solution?

I have used a rolling hash + binary search (as mentioned in the editorial).