CRANGIRL -A simple question based on z -algorithm


This is a simple question based on implementation of Z algorithm but i am getting wrong answer.
Can any one point out the bug or is there any tricky boundary case?
This is my submission:
https://ideone.com/thSLKc
1 Like