find longest common prefix of n strings