P16217 [GeeksforGeeks] Odd to even0537
普及-
题目描述

Given an odd number in the form of string, the task is to make largest even number possible from the given number provided one is allowed to do only one swap operation, if no such number is possible then return the input string itself.
Example 1:
Input:
s = 4543
Output: 4534
Explanation: Swap 4(3rd pos) and 3.

Example 2:
Input:
s = 1539
Output: 1539
Explanation: No even no. present.

Your Task:
You dont need to read input or print anything. Complete the function makeEven() which takes a string s as input parameter and returns a string after performing given operations.

Expected Time Complexity: O(Length of Input string).
Expected Auxiliary Space: O(1).

Constraints:
1 <= Length of odd number string<= 10^{5}

输入格式

见题面

输出格式

见题面

样例输入
s = 4543
样例输出
4534