{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eGiven is a string \u003cvar\u003e\\(s\\)\u003c/var\u003e of length \u003cvar\u003e\\(N\\)\u003c/var\u003e.\r\nLet \u003cvar\u003e\\(s_i\\)\u003c/var\u003e denote the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th character of \u003cvar\u003e\\(s\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eSnuke will transform \u003cvar\u003e\\(s\\)\u003c/var\u003e by the following procedure.\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eChoose an \u003cstrong\u003eeven length\u003c/strong\u003e (not necessarily contiguous) subsequence \u003cvar\u003e\\(x\u003d(x_1, x_2, \\ldots, x_{2k})\\)\u003c/var\u003e of \u003cvar\u003e\\((1,2, \\ldots, N)\\)\u003c/var\u003e (\u003cvar\u003e\\(k\\)\u003c/var\u003e may be \u003cvar\u003e\\(0\\)\u003c/var\u003e).\u003c/li\u003e\r\n\u003cli\u003eSwap \u003cvar\u003e\\(s_{x_1}\\)\u003c/var\u003e and \u003cvar\u003e\\(s_{x_{2k}}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eSwap \u003cvar\u003e\\(s_{x_2}\\)\u003c/var\u003e and \u003cvar\u003e\\(s_{x_{2k-1}}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eSwap \u003cvar\u003e\\(s_{x_3}\\)\u003c/var\u003e and \u003cvar\u003e\\(s_{x_{2k-2}}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(\\vdots\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eSwap \u003cvar\u003e\\(s_{x_{k}}\\)\u003c/var\u003e and \u003cvar\u003e\\(s_{x_{k+1}}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eAmong the strings that \u003cvar\u003e\\(s\\)\u003c/var\u003e can become after the procedure, find the lexicographically smallest one.\u003c/p\u003e\r\n\u003cdetails\u003e\r\n\u003csummary\u003eWhat is the lexicographical order?\u003c/summary\u003e\r\n\u003cp\u003e\r\nSimply speaking, the lexicographical order is the order in which words are listed in a dictionary. As a more formal definition, here is the algorithm to determine the lexicographical order between different strings \u003cvar\u003e\\(S\\)\u003c/var\u003e and \u003cvar\u003e\\(T\\)\u003c/var\u003e.\r\n\u003c/p\u003e\r\n\r\n\u003cp\u003eBelow, let \u003cvar\u003e\\(S_i\\)\u003c/var\u003e denote the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th character of \u003cvar\u003e\\(S\\)\u003c/var\u003e. Also, if \u003cvar\u003e\\(S\\)\u003c/var\u003e is lexicographically smaller than \u003cvar\u003e\\(T\\)\u003c/var\u003e, we will denote that fact as \u003cvar\u003e\\(S \\lt T\\)\u003c/var\u003e; if \u003cvar\u003e\\(S\\)\u003c/var\u003e is lexicographically larger than \u003cvar\u003e\\(T\\)\u003c/var\u003e, we will denote that fact as \u003cvar\u003e\\(S \\gt T\\)\u003c/var\u003e.\u003c/p\u003e\r\n\r\n\u003col\u003e\r\n \u003cli\u003e Let \u003cvar\u003e\\(L\\)\u003c/var\u003e be the smaller of the lengths of \u003cvar\u003e\\(S\\)\u003c/var\u003e and \u003cvar\u003e\\(T\\)\u003c/var\u003e. For each \u003cvar\u003e\\(i\u003d1,2,\\dots,L\\)\u003c/var\u003e, we check whether \u003cvar\u003e\\(S_i\\)\u003c/var\u003e and \u003cvar\u003e\\(T_i\\)\u003c/var\u003e are the same. \u003c/li\u003e\r\n \u003cli\u003e If there is an \u003cvar\u003e\\(i\\)\u003c/var\u003e such that \u003cvar\u003e\\(S_i \\neq T_i\\)\u003c/var\u003e, let \u003cvar\u003e\\(j\\)\u003c/var\u003e be the smallest such \u003cvar\u003e\\(i\\)\u003c/var\u003e. Then, we compare \u003cvar\u003e\\(S_j\\)\u003c/var\u003e and \u003cvar\u003e\\(T_j\\)\u003c/var\u003e. If \u003cvar\u003e\\(S_j\\)\u003c/var\u003e comes earlier than \u003cvar\u003e\\(T_j\\)\u003c/var\u003e in alphabetical order, we determine that \u003cvar\u003e\\(S \\lt T\\)\u003c/var\u003e and quit; if \u003cvar\u003e\\(S_j\\)\u003c/var\u003e comes later than \u003cvar\u003e\\(T_j\\)\u003c/var\u003e, we determine that \u003cvar\u003e\\(S \\gt T\\)\u003c/var\u003e and quit.\r\n \u003c/li\u003e\r\n \u003cli\u003e If there is no \u003cvar\u003e\\(i\\)\u003c/var\u003e such that \u003cvar\u003e\\(S_i \\neq T_i\\)\u003c/var\u003e, we compare the lengths of \u003cvar\u003e\\(S\\)\u003c/var\u003e and \u003cvar\u003e\\(T\\)\u003c/var\u003e. If \u003cvar\u003e\\(S\\)\u003c/var\u003e is shorter than \u003cvar\u003e\\(T\\)\u003c/var\u003e, we determine that \u003cvar\u003e\\(S \\lt T\\)\u003c/var\u003e and quit; if \u003cvar\u003e\\(S\\)\u003c/var\u003e is longer than \u003cvar\u003e\\(T\\)\u003c/var\u003e, we determine that \u003cvar\u003e\\(S \\gt T\\)\u003c/var\u003e and quit. \u003c/li\u003e\r\n\u003c/ol\u003e\r\n\r\n\u003c/details\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq N \\leq 2 \\times 10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(s\\)\u003c/var\u003e is a string of length \u003cvar\u003e\\(N\\)\u003c/var\u003e consisting of lowercase English letters.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(s\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the lexicographically smallest possible string \u003cvar\u003e\\(s\\)\u003c/var\u003e after the procedure by Snuke.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003e4\r\ndcab\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eacdb\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cul\u003e\r\n\u003cli\u003eWhen \u003cvar\u003e\\(x\u003d(1,3)\\)\u003c/var\u003e, the procedure just swaps \u003cvar\u003e\\(s_{1}\\)\u003c/var\u003e and \u003cvar\u003e\\(s_{3}\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eThe \u003cvar\u003e\\(s\\)\u003c/var\u003e after the procedure is \u003ccode\u003eacdb\u003c/code\u003e, the lexicographically smallest possible result.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e2\r\nab\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eab\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cul\u003e\r\n\u003cli\u003eWhen \u003cvar\u003e\\(x\u003d()\\)\u003c/var\u003e, the \u003cvar\u003e\\(s\\)\u003c/var\u003e after the procedure is \u003ccode\u003eab\u003c/code\u003e, the lexicographically smallest possible result.\u003c/li\u003e\r\n\u003cli\u003eNote that \u003cvar\u003e\\(x\\)\u003c/var\u003e may have a length of \u003cvar\u003e\\(0\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e16\r\ncabaaabbbabcbaba\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eaaaaaaabbbbcbbbc\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 4","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\u003e17\r\nsnwfpfwipeusiwkzo\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eeffwpnwipsusiwkzo\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}