# False Number Codechef Solution

Page Contents

## False Number Solution Problem Code: FALSNUM

One day, Chef’s friend gave him a wrong number WW containing N+1N+1 digits and said that the actual number AA is the largest possible number that can be obtained from deleting exactly one digit of WW. Chef was able to find AA but forgot WW.

Given AA, find the smallest possible number WW of length N+1N+1 without leading 00’s that is consistent with the story above. We can show that there is always at least one such WW consistent with the story.

### Input

• The first line contains an integer TT, the number of test cases. Then the test cases follow.
• Each test case contains a single line of input, an integer AA.

### Output

For each testcase, output in a single line string representing the answer to the problem.

### Constraints

• 1≤T≤1001≤T≤100
• 0≤Ai≤90≤Ai≤9 for all valid ii, where AiAi denotes the ii-th digit of AA
• 10≤|A|≤500010≤|A|≤5000, where |A||A| denotes the number of digits of AA

Subtask #1 (100 points): Original constraints

### Sample Input

``````2
9876543211
12345678999
``````

### Sample Output

``````19876543211
102345678999
``````

### Explanation

It can be proven that the above output strings are the smallest possible numbers from which you can arrive at the correct number in the input.

Program:

``````#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;

void solve(){

string s;
cin>>s;

if(s != '1'){
cout<<"1"<<s<<endl;
return ;
}

cout<<s<<"0";

for(int i=1;i<s.size();i++) cout<<s[i];
cout<<endl;

}

int32_t main(){

#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif

int T;
cin>>T;
while(T--){
solve();
}

}

``````