Longest common pattern-Getting WA

I have used the same logic as that given in editorial but still I am getting WA.So,please can somebody give a test case for which I am wrong?
My code-CodeChef: Practical coding for everyone

4 Likes