Hello I am getting wrong answer for FINDSR.
I have used the failure function of KMP. Here's the link to the code - ideone.com/7iwX5G.