dynamic longest common ss