PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000198. Xóa chữ số để giành giải thưởng (Erasing and Winning)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xóa chữ số để giành giải thưởng (Erasing and Winning)

Erasing and Winning

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

On the television show Erasing and Winning, the host writes a positive integer with NN digits on a board. The contestant must erase exactly DD digits. The remaining digits, in their original relative order, form the prize amount.

Digits cannot be rearranged, changed, or added. The original number has no leading zero, although zeroes may appear elsewhere.

Find the largest number obtainable after exactly DD deletions. Since the result may contain many digits, print its decimal representation directly. Exactly N−DN-D digits remain.

Input

  • The first line contains integers NN and DD: the initial number of digits and the exact number of digits to erase.
  • The second line contains exactly NN decimal digits, with its first digit different from 0.

Output

Print one line containing exactly N−DN-D digits: the largest number obtainable after deleting exactly DD digits while preserving order.

Subtasks

  • Subtask 1 (20 points): 2≤N≤92\le N\le 9; 1≤D<N1\le D<N; The digit string has length NN and does not begin with 0.
  • Subtask 2 (30 points): 2≤N≤20002\le N\le 2000; 1≤D<N1\le D<N; The digit string has length NN and does not begin with 0.
  • Subtask 3 (50 points): 2≤N≤1052\le N\le 10^5; 1≤D<N1\le D<N; The digit string has length NN and does not begin with 0.

Examples

Input

4 2
3759

Output

79

Explanation

There are four digits 3, 7, 5, 9, and exactly two must be deleted. The order-preserving pairs are 37, 35, 39, 75, 79, and 59. The largest is 79, obtained by deleting 3 at position 11 and 5 at position 33.