Given a positive integer N. The task is to find the smallest even number E such that E > N and digits in N and E are same.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer N.
For each test case in a new line print the required smallest even number. If no such even number exist print -1.
1 <= T <= 105
1 <= N <= 1018
Testcas 1: Next greater number with same digits as in input is 34724126.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.