Start

2020-06-13 09:00 AKDT

UTD20s10

End

2020-06-13 12:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -62 days 6:19:45

Time elapsed

3:00:00

Time remaining

0:00:00

Problem F
Swap Frenzy

/problems/swapfrenzy/file/statement/en/img-0001.jpg
Image by Katey

You are given a positive integer $n$ and asked to make it larger by swapping pairs of its digits. For each swap, you can choose two digits at different positions and exchange their positions, as long as the swap does not result in a leading zero. What is the largest number you can get after performing exactly $k$ swaps?

Input

The input has a single line with two integers $n$ ($100 \leq n < 10^{18}$) and $k$ ($1 \leq k \leq 18$).

Output

Output the largest number you can get after exactly $k$ swaps.

Sample Input 1 Sample Output 1
1374 2
7413
Sample Input 2 Sample Output 2
210 1
201
Sample Input 3 Sample Output 3
666 3
666