MAX_NUM - finding maximum possible number

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.


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

hide comments
2013-05-02 06:48:14 shiva_hellgeek
@praveen123 unable to find why i'm getting WA again and again. please suggest what is wrong with my code. ID- 8700260
2013-05-02 06:48:14 praveen123
@Meraj Ahmed read problem carefully
2013-05-02 06:48:14 Meraj Ahmed
@praveen123: could you tell me where my solution is failing...it says wrong answer in judge 3. submission id: 8694915
2013-05-02 06:48:14 Ehor Nechiporenko
@Tjandra, good job! Brilliant optimizing!
2013-05-02 06:48:14 praveen123
@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
2013-05-02 06:48:14 (Tjandra Satria Gunawan)(曾毅昆)
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
2013-05-02 06:48:14 praveen123
@jab tak hai jaan:
I had added an extra line to take your case. Thanks for pointing it out.
2013-05-02 06:48:14 Thotsaphon Thanatipanonda
My Java program can run within 0.20 sec without any special optimization.
2013-05-02 06:48:14 Akb
what to print if k=(no of digits in the number)??
why did you keep your problem incomplete?
2013-05-02 06:48:14 :D
The only real problem was that i/o was incorrect. You may change the time limit, so that JAVA could pass easier.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.