Problem list
Log in
#coci00212 · COCI 2011/2012 Contest 4

Keks

Gold III 1.0 s 32 MB

Mirko and Slavko are bored at math class again so they came up with new game. Mirko writes down an N digit number, and Slavko’s task is to obtain the largest possible number after having removed exactly K digits. Help him do that!

Input

The first line of input contains integers N and K ($1 \le K < N \le 500,000$). The following line contains N digit number. This number starts with non-zero digit.

Output

The first and only line of output should contain the largest possible number Slavko can obtain by removing K digits from the given number.

Constraints

In test cases worth 50% of total points, N will not exceed 1000.

Example 1

Input
4 2
1924
Output
94

Example 2

Input
7 3
1231234
Output
3234

Example 3

Input
10 4
4177252841
Output
775841
Source
COCI 2011/2012 Contest 4
Appears in
Not part of a ladder, contest or set yet.
Accepted 1 Submissions 1 Acceptance 100% Solvers 1

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code