add longest common prefix solution