题库练习 Pasha Maximizes
← 上一题 下一题 →

A9543 | Pasha Maximizes

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

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
C++ 编辑器
输入
输出