#d11402. 单词合并
单词合并
Word Merging
Problem Description
xyq has words and wants to turn them into a single sentence.
Concretely, he merges the words two at a time, from left to right. When merging two words, find the largest such that the length- suffix of the first word equals the length- prefix of the second word, then append the part of the second word after position to the end of the first word.
Output the final merged word.
Input Format
The first line contains an integer (), the number of words.
The next line contains strings , separated by spaces, representing the words. The total length of all strings is guaranteed not to exceed .
Output Format
One line containing a single string: the merged answer.
Sample Input
5
sample please ease in out
Sample Output
sampleaseinout