via longest common subsequences