提示: 欢迎访问OurACM平台。
Problem 1853 Number Deletion

Accept: 90    Submit: 278
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Given you one n-digital positive integer a,After removing any of them k( k < n) digits, the remaining figures form a new positive integer according to the origin order. For a given n-digital positive integers a and positive integer k. Now ask you to find a algorithm to minimize the remaining integer.

Input

The first line contains one integer t, represents the number of test cases.

Then following t lines,each line contain two numbers a,k (0 < a < 10^1000, k is less than the length of a).

Output

Output the mininum number after the deletion.(the number can not contain leading zero)">it means that we should ignore the leading zeros of the output number

Sample Input

1 178543 4

Sample Output

13

Source

FOJ有奖月赛-2009年10月——稚鹰翱翔

Submit  Back  Status  Discuss