{"problem":{"name":"Reserve or Reverse","description":{"content":"Given is a string $s$ of length $N$. Let $s_i$ denote the $i$\\-th character of $s$. Snuke will transform $s$ by the following procedure. *   Choose an **even length** (not necessarily contiguous) sub","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc134_b"},"statements":[{"statement_type":"Markdown","content":"Given is a string $s$ of length $N$. Let $s_i$ denote the $i$\\-th character of $s$.\nSnuke will transform $s$ by the following procedure.\n\n*   Choose an **even length** (not necessarily contiguous) subsequence $x=(x_1, x_2, \\ldots, x_{2k})$ of $(1,2, \\ldots, N)$ ($k$ may be $0$).\n*   Swap $s_{x_1}$ and $s_{x_{2k}}$.\n*   Swap $s_{x_2}$ and $s_{x_{2k-1}}$.\n*   Swap $s_{x_3}$ and $s_{x_{2k-2}}$.\n*   $\\vdots$\n*   Swap $s_{x_{k}}$ and $s_{x_{k+1}}$.\n\nAmong the strings that $s$ can become after the procedure, find the lexicographically smallest one.\nWhat is the lexicographical order?Simply 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 $S$ and $T$.\nBelow, let $S_i$ denote the $i$\\-th character of $S$. Also, if $S$ is lexicographically smaller than $T$, we will denote that fact as $S \\lt T$; if $S$ is lexicographically larger than $T$, we will denote that fact as $S \\gt T$.\n\n1.  Let $L$ be the smaller of the lengths of $S$ and $T$. For each $i=1,2,\\dots,L$, we check whether $S_i$ and $T_i$ are the same.\n2.  If there is an $i$ such that $S_i \\neq T_i$, let $j$ be the smallest such $i$. Then, we compare $S_j$ and $T_j$. If $S_j$ comes earlier than $T_j$ in alphabetical order, we determine that $S \\lt T$ and quit; if $S_j$ comes later than $T_j$, we determine that $S \\gt T$ and quit.\n3.  If there is no $i$ such that $S_i \\neq T_i$, we compare the lengths of $S$ and $T$. If $S$ is shorter than $T$, we determine that $S \\lt T$ and quit; if $S$ is longer than $T$, we determine that $S \\gt T$ and quit.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $s$ is a string of length $N$ consisting of lowercase English letters.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$s$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc134_b","tags":[],"sample_group":[["4\ndcab","acdb\n\n*   When $x=(1,3)$, the procedure just swaps $s_{1}$ and $s_{3}$.\n*   The $s$ after the procedure is `acdb`, the lexicographically smallest possible result."],["2\nab","ab\n\n*   When $x=()$, the $s$ after the procedure is `ab`, the lexicographically smallest possible result.\n*   Note that $x$ may have a length of $0$."],["16\ncabaaabbbabcbaba","aaaaaaabbbbcbbbc"],["17\nsnwfpfwipeusiwkzo","effwpnwipsusiwkzo"]],"created_at":"2026-03-03 11:01:14"}}