add longest common prefix