dynamic programming: longest common sequence