Compute nearest larger number by interchanging digits updated.
Given 2 numbers a and b find the smallest number greater than b by interchanging the digits of a and if not possible print -1.
Constraints
1 <= a,b <= 10000000
Input Format
2 numbers, a and b, separated by space.
Output
A single number, greater than than b.
If not possible, print -1.
Test Case
Explanation
Example 1
Input
459 500
Output
549
Example 2
Input
645757 457765
Output
465577
Example 3
Input
5964 9984
Output
-1
Answers
Answered by
4
Answer:
I don't know answer please mark me as brainiest
Answered by
0
Answer:
i don't know the answer of this type of questions
Similar questions
Business Studies,
5 months ago
Physics,
5 months ago
Art,
5 months ago
English,
10 months ago
English,
10 months ago