String Matching is an important problem in computer science research and finds applications in data mining, pattern recognition, and many more areas.
The problem we consider here is a smaller version of it. You are given a set of strings. You have to find a string which all given strings are the substring of it.
A substring is a contiguous sequence of characters within a string. Such as “love” is a substring of “I love you”.
In here there are no common characters between any two strings. And you should print the string so that substring of all given strings are a consecutive sequence.
Try to print the string so that the length is as minimum as possible.
In the first line there is an integer N (1 ≤ N ≤ 25) which is the number of strings and the following N lines are the strings. The only characters that will occur are lowercase characters of English alphabet (‘a’-‘z’). String lengths will be less or equal to 26.
Just print the string in a line.
2 a b