#P1323. 删数问题
删数问题
Description
A set is defined as follows: is an element of the set; if is an element of the set, then and are also elements of the set.
Take the smallest elements from this set, concatenate them in increasing order to form a multi-digit integer. You are required to delete digits from this integer so that the remaining number is as large as possible. Write a program to output the integer before deletion and the integer after deletion.
Note: It is guaranteed that not all digits are deleted.
Input Format
A single line with two integers representing and .
Output Format
Output two lines. The first line is the number before deletion. The second line is the number after deletion.
5 4
137915
95
Hint
Constraints
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号