{"problem":{"name":"M. Two Operations","description":{"content":"Ayoub has a string $S$ consists of only lower case Latin letters, and he wants you to make some operations on it: Ayoub wants you to make the string lexicographically maximal using the mentioned oper","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10226M"},"statements":[{"statement_type":"Markdown","content":"Ayoub has a string $S$ consists of only lower case Latin letters, and he wants you to make some operations on it:\n\nAyoub wants you to make the string lexicographically maximal using the mentioned operations as many times as you want, can you help him?\n\nString $x = x_1 x_2... x_{| x |}$ is lexicographically larger than string $y = y_1 y_2... y_{| y |}$, if either $| x | > | y |$ and $x_1 = y_1, x_2 = y_2,..., x_{| y |} = y_{| y |}$, or exists such number $r (r < | x |, r < | y |)$, that $x_1 = y_1, x_2 = y_2,..., x_r = y_r$ and $x_r + 1 > y_r + 1$. Characters in lines are compared like their ASCII codes.\n\nThe input contains a single string $S$ $(1 <= | S | <= 10^5)$.\n\nIt is guaranteed that string $S$ consists of only lower case Latin letters.\n\nprint the lexicographically maximal string that could be obtained using these two operations.\n\nIn the first test case Ayoub replaced $\\\"b b\\\"$ with $\\\"c\\\"$ so the string has been changed to $\\\"a c x\\\"$, then he swapped 'a' with 'x' so the result is $\\\"x c a\\\"$ and it is the lexicographically maximal string.\n\n## Input\n\nThe input contains a single string $S$ $(1 <= | S | <= 10^5)$.It is guaranteed that string $S$ consists of only lower case Latin letters.\n\n## Output\n\nprint the lexicographically maximal string that could be obtained using these two operations.\n\n[samples]\n\n## Note\n\nIn the first test case Ayoub replaced $\\\"b b\\\"$ with $\\\"c\\\"$ so the string has been changed to $\\\"a c x\\\"$, then he swapped 'a' with 'x' so the result is $\\\"x c a\\\"$ and it is the lexicographically maximal string.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ S = s_1 s_2 \\dots s_n $ be a string of length $ n \\geq 1 $, where $ s_i \\in \\{a, b, \\dots, z\\} $ for all $ i $.\n\n**Operations**  \nTwo operations may be applied any number of times in any order:  \n1. **Replace**: If two consecutive characters $ s_i = s_{i+1} = c $, replace them with the next letter: $ s_i s_{i+1} \\to \\text{chr}(\\text{ord}(c) + 1) $.  \n2. **Swap**: Any two adjacent characters may be swapped.\n\n**Constraints**  \n- $ 1 \\leq n \\leq 10^5 $  \n- All characters in $ S $ are lowercase Latin letters.\n\n**Objective**  \nFind the lexicographically maximal string obtainable from $ S $ via any sequence of the above operations.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10226M","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}