测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A9543. Pasha Maximizes

编程题 普及/提高-

题目描述

Pasha has a positive integer $a$ without leading zeroes. Today he decided that the number is too small and he should make it larger. Unfortunately, the only operation Pasha can do is to swap two adjacent decimal digits of the integer.

Help Pasha count the maximum number he can get if he has the time to make at most $k$ swaps.

输入格式

The single line contains two integers $a$ and $k$ $(1<=a<=10^{18}; 0<=k<=100)$ .

输出格式

Print the maximum number that Pasha can get if he makes at most $k$ swaps.

输入输出样例

输入 #1
1990 1
输出 #1
9190
输入 #2
300 0
输出 #2
300
输入 #3
1034 2
输出 #3
3104
输入 #4
9090000078001234 6
输出 #4
9907000008001234
上一题 去做题 下一题