← 返回 sofi 的题目列表Maximize Number by Swapping Adjacent Same-Parity Digits
类型:online_judge
sofi
Given a string s consisting only of digits. Two adjacent digits with the same parity can be swapped. Determine the largest number that can be obtained through valid swaps. The length of the string n does not exceed 10^5.
Example
Input: s = "1234" Output: "4231"
Input: s = "4321" Output: "4321"
Constraints
The string consists of digits only
Length of the string n <= 10^5
Example
Input
1234