MAX_NUM - finding maximum possible number

no tags 

Given a number n, Find out what max possible number you can make by deleting exactly k digits.

T : number of test cases <= 10^3.

1 <= number of digits in n <= 10^5. (n might contain leading zeros.)

0 <= k <= n

if value of n is equal to k. then just print a new line.

Input

T: number of test cases.

T lines follow each with n and k.

Output

max possible number.

Example

Input:
2
1223 2
8756 2

Output:
23
87

Explanation

Note that left to right order should be maintained. As in the example given answer is 23 not 32.


hide comments
Gaurav: 2013-05-02 06:48:14

@praveen123: I am getting WA though my code is satisfying given test cases and my test cases. Can you tell me what is wrong in my output? Code ID-8721212

Akhil Rao: 2013-05-02 06:48:14

@praveen123 I was way off. Nice problem. Enjoyed it :)

praveen123: 2013-05-02 06:48:14

@abhinav : 33 , reread the problem statement.
@akhil rao: slightly wrong, So rethinking and generating some test cases yourself might help.
@fringe : I do not believe that you understood the problem. You are ouputting a single value on all the test cases.

Last edit: 2013-02-13 19:05:39
:D: 2013-05-02 06:48:14

You don't have to be tutored. Nobody expect fluent English here. Just don't break it on purpose with "wut", "wit" and the like. It just makes text hard to read, especially when it's on top of other language problems. I honestly don't know why so many people do that here. As for the English itself, start with enabling an automatic error checking in your browser. That's what I do.

Last edit: 2013-02-13 17:54:30
:D: 2013-05-02 06:48:14

Also Fringe, if you're going to make any request of any kind, use English not gibberish.

Mitch Schwartz: 2013-05-02 06:48:14

Finding bugs in your own code is part of the problem solving process.

And only you and the problem setter (and admins, but they wouldn't get involved) can see your submissions.

Sometimes a problem setter will give some hint about why some code fails, but in general it's unreasonable to expect them to do so, especially when a solver gives no indication of doing proper bug-testing, etc. There's also a forum where you may ask for help with debugging; the chance of getting helped could depend somewhat on how popular the problem is (and be sure to read the post "Read this before posting!" by TripleM).

Last edit: 2013-02-13 07:22:12
Fringe: 2013-05-02 06:48:14

i hate spoj.....if u don't know where is your mistake how wud u improve :/

ps: if any one cud tell me wats wrong wid my code...it wud be of grt help -- prob code :8705268!

Akhil Rao: 2013-05-02 06:48:14

@praveen123 unable to find why i'm getting WA again and again. please suggest what is wrong with my code. ID- 8705244

johri: 2013-05-02 06:48:14

if u cud tell me that for 313 if k=1 33 is the right ans or 31..pls

Last edit: 2013-02-13 09:19:44
praveen123: 2013-05-02 06:48:14

@shiva bhalla , please try some more cases and test your algorithm , May be a brute force generator for testing might help.


Added by:praveen123
Date:2013-02-09
Time limit:0.407s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:general