Lcs with 3 string

can you check my code why it gives wrong output