PalantirOA #1
Swap Parity
简单可在线判题
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