K- Ordered LCS Problem

Rectify my code and let me know what is the issue

Try this:

Thanks a lot it passed