get the longest common sequence