Add impl for longest common prefix.