{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no human resemblance; these typically have geometric or amorphous shapes like cubes, oil slicks or clouds of dust. \u003c/p\u003e\u003cp\u003eThe answer is given in the 146th episode of \u003ci\u003eStar Trek - The Next Generation\u003c/i\u003e, titled \u003ci\u003eThe Chase\u003c/i\u003e. It turns out that in the vast majority of the quadrant\u0027s life forms ended up with a large fragment of common DNA. \u003c/p\u003e\u003cp\u003eGiven the DNA sequences of several life forms represented as strings of letters, you are to find the longest substring that is shared by more than half of them. \u003c/p\u003e\n给出n个字符串,求出现次数超过n/2次及以上的最长子串,如果有多组按字典序输出,没有输出?。"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eStandard input contains several test cases. Each test case begins with 1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 100, the number of life forms. \u003ci\u003en\u003c/i\u003e lines follow; each contains a string of lower case letters representing the DNA sequence of a life form. Each DNA sequence contains at least one and not more than 1000 letters. A line containing 0 follows the last test case. \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output the longest string or strings shared by more than half of the life forms. If there are many, output all of them in alphabetical order. If there is no solution with at least one letter, output \"?\". Leave an empty line between test cases. \u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\nbcdefgh\ncdefghi\n3\nxxx\nyyy\nzzz\n0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003ebcdefg\ncdefgh\n\n?\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}