#Lutece0666. Krolia's Number
Krolia's Number
Migrated from Lutece 666 Krolia's Number
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Krolia define a new number which is called Kumber. To get a Kumber, one must do a Kumber Transformation on a positive integer which don't contains the digit .
A Kumber Transformation is that delete a digit () in the integer times. For example, and the integer , which means you must delete one digit ,one digit and one digit from .After the Kumber Transformation you will get some Kumbers such as
Given and the positive integer , you must find the largest Kumber which one can get from that Kumber Transformation.
Input
There is only one integer () in the first line indicating the number of test cases.
The first line of each test cases contains an integer (,No -digit in number ), and the second line contains numbers ().We guarantee that the integer contains at least digit and the sum of is less than the length of n(that is to say, you won't get nothing after the transformation).
Output
For each test case, output an integer which is the largest Kumber you can get.
Samples
2
123321
1 1 1 0 0 0 0 0 0
212
0 1 0 0 0 0 0 0 0
321
21
Resources
KroliaFansClub