LCS with 3 strings (wrong answer)

My code is showing wrong answer for one test case out of 5

plz check the code and correct the mistake.

problem : https://online.codingblocks.com/app/player/39658/content/77394/5201/code-challenge

code : https://ide.codingblocks.com/s/215327

plz reply ASAP

@sengarankit98
hello Ankit,
this logic will fail when first 2 strings will have more than one lcs.

for ex->
abc
acb
abd

here lcs of first 2 strings can be (ab , ac)
if u pick ab and take its lcs with abd then resultant lcs will be of length 2.
if u pick ac and take its lcs with abd then resultant lcs will be of length 1.

clearly ur will fail for above such cases.

use 3d dp to solve this problem