Create longest common pattern