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
shiva_hellgeek: 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- 8700260

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

@Meraj Ahmed read problem carefully

Meraj Ahmed: 2013-05-02 06:48:14

@praveen123: could you tell me where my solution is failing...it says wrong answer in judge 3. submission id: 8694915

Ehor Nechiporenko: 2013-05-02 06:48:14

@Tjandra, good job! Brilliant optimizing!

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

@Tjandra Satria Gunawan , On your suggestion I have changed the judge and rejudged all the submissions. Now I also feel like that time limit is good enough for java users also.
Glad that you liked the problem.

Last edit: 2013-02-11 06:46:06
(Tjandra Satria Gunawan)(曾毅昆): 2013-05-02 06:48:14

Nice problem :-D could you change the cluster to pyramid? I want to know my program running time more accurately..
EDIT: Thanks

Last edit: 2013-02-11 06:44:58
praveen123: 2013-05-02 06:48:14

@jab tak hai jaan:
I had added an extra line to take your case. Thanks for pointing it out.

Thotsaphon Thanatipanonda: 2013-05-02 06:48:14

My Java program can run within 0.20 sec without any special optimization.

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

what to print if k=(no of digits in the number)??
why did you keep your problem incomplete?

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

The only real problem was that i/o was incorrect. You may change the time limit, so that JAVA could pass easier.


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