P29795 [洛谷] [COCI2011-2012#4] KEKS
普及
题目描述

Problem Description

Given positive integers $N$ and $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$ and $K$.

The second line contains an $N$-digit integer. It is guaranteed that there are no leading zeros.

Output Format

Output the maximum value of the remaining number.

Sample Input and Output

Sample Input #1

4 2
1924

Sample Output #1

94

Sample Input #2

7 3
1231234

Sample Output #2

3234

Sample Input #3

10 4
4177252841

Sample Output #3

775841

Notes

[Data Range and Constraints]

  • For $50\%$ of the test cases, $N \le 1000$.
  • For $100\%$ of the test cases, $1 \le K < N \le 5 \times 10^5$.

[Translation and Original Source]

This problem is translated from COCI 2011-2012 CONTEST #4 Task 3 KEKS.

The score for this problem is set according to the original COCI contest, with a maximum score of $100$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 2 1924
样例输出
94