I used the following code:
https://code.hackerearth.com/1af786V
I received a WA for the same. The accepted code used scanf() in place of cin and a function to find the length of LCS. Rest all remained completely same. I am unable to find the problem in the original version that got WA verdict. Can anyone point out the mistake(s) ?