cswork / OA打开练习工作台

PalantirOA #1

Swap Parity

简单可在线判题

考点(AI 标注)字符串贪心调度

You are given a digit string. You may swap adjacent digits of the same parity any number of times. Find the largest number obtainable. The digits within each same-parity sequence can be rearranged arbitrarily.

输入格式

One line containing a string num consisting only of the digits 0–9, with 1≤length≤100000.

输出格式

Output the largest obtainable number as a string.

样例 1

输入:

7596801

输出:

9758601

样例 2

输入:

0082663

输出:

8662003

样例 3

输入:

0

输出:

0