Solving longest common subsequence problem.