{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere are \u003cem\u003eN\u003c/em\u003e magical words, s\u003csub\u003e1\u003c/sub\u003e, s\u003csub\u003e2\u003c/sub\u003e ... s\u003csub\u003eN\u003c/sub\u003e, each of them consists of \u003cb\u003eseven\u003c/b\u003e distinguish low-case letters.\u003c/p\u003e\n\n\u003cp\u003eA mighty string is a string that contains all the magical words in order. That means, string str[1..L] is a mighty string if and only if there exists 0 \u0026lt; k\u003csub\u003e1\u003c/sub\u003e \u0026lt; k\u003csub\u003e2\u003c/sub\u003e \u0026lt; ... \u0026lt; k\u003csub\u003eN\u003c/sub\u003e \u0026lt; L, where s\u003csub\u003ei\u003c/sub\u003e is a prefix of str[k\u003csub\u003ei\u003c/sub\u003e..L].\u003c/p\u003e\n\n\u003cp\u003eI know you are very skilled in algorithms and you can easily find the shortest mighty string in no time. But can you find the shortest palindromic mighty string? That is, the shortest mighty string whose reverse is itself.\u003c/p\u003e\n\n\u003ch4\u003eInput\u003c/h4\u003e\n\n\u003cp\u003eNo more than 130 cases. For each case, first line is \u003cem\u003eN\u003c/em\u003e and then \u003cem\u003eN\u003c/em\u003e magical words in the second line.\u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\n\u003cp\u003eFor each case, output the shortest palindromic mighty string in one line. If multiple answers exist, output the lexicographically smallest one.\u003c/p\u003e\n\n\u003cp\u003eThe length of each answer is guaranteed to be no longer than 100 characters.\u003c/p\u003e\n\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\nabcdefg cdefghi hgfedcb\n2\nabcdefg abcdefg\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eabcdefghihgfedcba\nabcdefgfedcbabcdefgfedcba\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n"}}]}