Superstring - MarisaOJ: Marisa Online Judge

Superstring

Time limit: 1000 ms
Memory limit: 256 MB
You are given n string S1,S2,...,Sn. Find the shortest string S that S1,S2,...,Sn are substrings of S. ### Input - The first line contains an integer n. - The next n lines, each line contains a string Si. ### Output - Print the shortest string. ### Constraints - 1≤n≤20. - 1≤|Si|≤100. ### Example Input: 3abbda Output: dab