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-http://www.codechef.com/viewsolution/4517429

https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1346

4 Likes