Company: Barclays
Difficulty: medium
The Maximum Length The first line of the input consists of an integer - size , representing the given number of people ( N ). The second line consists of N space-separated strings representing the first names of the people. Print a string in lowercase letters representing the name of the town of the given N people where the name of the town is the common substring and has the maximum length. If no such common prefix is found, then do not print anything. Input Format The first line contains an integer size , the number of people. The second line contains N space-separated strings representing the first names. Output Format Print a string representing the name of the town, which is the common substring with the maximum length. If no such common substring exists, print nothing. Constraints 0 ≤ size ≤ 10 5 0 < len < 10 6 , where len is the length of the string. Examples Input: 5 Rosewood rose rosy rosemary roshh Output: ros The common substring with the maximum length in the list of