solved longest common subsequence