Question 2 : Largest Even Number | InfyTQ Previous Question
A string which is a mixture of letters ,numbers and special characters from which produce the largest possible even number from the available digit after removing the duplicates digits from the input string.
If an even number did not produce then return -1.
Constraints
4 <= Size of String <= 100
Input Format :
First line will be given string which will contain alphabets , digits and special characters.
Output Format : Print largest possible even number using distinct digits only from input string.
Test Case 1
Input :
infosys@337
Output :
-1
Explanation 1
There is no even number possible using digits from Above String.
So output will be
-1.
Test Case 2
Input :
Hello#81@219349
Output :
984312
Explanation 2
So after taking distinct digits 1, 2, 3, 4, 8, 9 from input string.
So largest possible even number using these digits will be
984312.