P8082 [COCI 2011/2012 #4] KEKS

Description

Given positive integers $N, K$ and an $N$-digit number, find the maximum value of the number remaining after deleting $K$ digits from the $N$-digit number.

Input Format

The first line contains two integers $N, K$. The second line contains an $N$-digit integer. It is guaranteed to have no leading $0$.

Output Format

Output the maximum value of the remaining number.

Explanation/Hint

**【Constraints】** - For $50\%$ of the testdata, $N \le 1000$. - For $100\%$ of the testdata, $1 \le K \lt N \le 5 \times 10^5$. **【Hints and Notes】** **This problem is translated from [COCI 2011-2012](https://hsin.hr/coci/archive/2011_2012/) [CONTEST #4](https://hsin.hr/coci/archive/2011_2012/contest4_tasks.pdf) _Task 3 KEKS_.** **The score setting of this problem follows the original COCI problem, with a full score of $100$.** Translated by ChatGPT 5