Lcs print code problem


my code is printing extra character after the ans.plz tell the problem