Given a no N you can perform an operation in it in which you can change a digit 5 to 6 and vice versa. Now your task is to print the sum of the max no and the min no obtained by performing such operations.
The first line of input contains an integer T denoting the no of test cases. Then T test case follow . Each test case contains a number N.
For each test case in a new line print the required sum.
For first test case
The max no which can be formed is 36 and the min no which can be formed is 35 itself
sum : 36+35 = 71
For second test case
sum : 5+6 = 11
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.