{"problem":{"name":"Synchronized Subsequence","description":{"content":"You are given a string $S$ of length $2N$, containing $N$ occurrences of `a` and $N$ occurrences of `b`. You will choose some of the characters in $S$. Here, for each $i = 1,2,...,N$, it is not allowe","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc026_e"},"statements":[{"statement_type":"Markdown","content":"You are given a string $S$ of length $2N$, containing $N$ occurrences of `a` and $N$ occurrences of `b`.\nYou will choose some of the characters in $S$. Here, for each $i = 1,2,...,N$, it is not allowed to choose exactly one of the following two: the $i$\\-th occurrence of `a` and the $i$\\-th occurrence of `b`. (That is, you can only choose both or neither.) Then, you will concatenate the chosen characters (without changing the order).\nFind the lexicographically largest string that can be obtained in this way.\n\n## Constraints\n\n*   $1 \\leq N \\leq 3000$\n*   $S$ is a string of length $2N$ containing $N$ occurrences of `a` and $N$ occurrences of `b`.\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":"agc026_e","tags":[],"sample_group":[["3\naababb","abab\n\nA subsequence of $T$ obtained from taking the first, third, fourth and sixth characters in $S$, satisfies the condition."],["3\nbbabaa","bbabaa\n\nYou can choose all the characters."],["6\nbbbaabbabaaa","bbbabaaa"],["9\nabbbaababaababbaba","bbaababababa"]],"created_at":"2026-03-03 11:01:13"}}