Digit Deletion
You are given an -digit natural number and a list of digits. The list contains only digits from to . Each digit in the list must be deleted from the number.
The list may contain the same digit multiple times, meaning it must be deleted from the number multiple times. However, deletion is always feasible: all the digits in the list appear in the number at least as many times as they appear in the list.
Your goal is to end up with the largest possible number after deleting all the digits appearing in the list.
Input File
The input consists of two lines. The first line contains the -digit natural number. The second line contains the list of digits, one after the other, without any spaces.
Output File
The output should consist of a single line with a natural number of digits: the largest possible number that can be obtained after deleting the digits from the original number.
Examples of Input - Output Files:
1st
STDIN (rdigits.in)
23891343798921
22878193199
STDOUT (rdigits.out)
343
2nd
STDIN (rdigits.in)
123456654321
654321
STDOUT (rdigits.out)
654321
Constraints
- .
- .
- Maximum Execution Time: 1 sec.
- Maximum Available Memory: 64 MB.
Comments