P1106 Delete Digits Problem
Description
Input a high-precision positive integer $n$ (no more than $250$ digits). After removing any $k$ digits, the remaining digits, kept in their original left-to-right order, form a new non-negative integer. Given $n$ and $k$, write a program to find a strategy to remove digits so that the resulting number is minimal.
Input Format
The input consists of two lines of positive integers.
The first line contains the high-precision positive integer $n$.
The second line contains the positive integer $k$, the number of digits to delete.
Output Format
Output a single integer: the minimal possible remaining number.
Explanation/Hint
Let $\operatorname{len}(n)$ denote the number of digits of $n$, and it is guaranteed that $1 \leq k < \operatorname{len}(n) \leq 250$.
Note: after deleting some digits, the remaining number may have leading zeros, but do not output leading zeros.
Translated by ChatGPT 5