P14052 [Kattis] Swapfrenzy
提高
题目描述

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.

-----Examples-----
Sample Input 1:
1374 2
Sample Output 1:
7413

Sample Input 2:
210 1
Sample Output 2:
201

输入格式

见题面

输出格式

见题面

样例输入
1374 2
样例输出
7413