Time limit
2s
Memory limit
128 MB
In a command prompt, entering dir pattern searches only for file names that match the pattern. A pattern may contain lowercase English letters, periods (.), and question marks (?). A question mark matches any single character.
You are given the file names that appeared in a search result. Print a pattern that can produce this result. Use as few question marks as possible. The directory contains only the given files, and all file names have the same length.
The first line contains the number of file names, N. Each of the next N lines contains one file name.
N is a positive integer not greater than 50. All file names have the same length, and the length is at most 50. Each file name consists only of lowercase English letters and periods (.).
Print one pattern that contains all given file names and uses the minimum possible number of question marks.