IOPC14R : WA - Unable to understand where I'm getting the WA

The problem i’m trying to solve is the IOPC14R, viz. , LCS Returns.

Now I did see the accepted solutions and are very similar to my solution . The thing is that I am getting a WA and dont know at what test case it’s failing . It would be very helpful if some one could point it out , meanwhile I will keep trying to find it out too.

Thank you.

//