COCI '11 Contest 4 #3 Keks

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 1.0s
Memory limit: 32M

Problem type

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 Specification

The first line of input contains integers N and K (1 \leq K < N \leq 500\,000).

The following line contains N digit number. This number starts with non-zero digit.

Output Specification

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

Scoring

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

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

Comments

There are no comments at the moment.