Infosys interview question

write a program to find longest common prefix