302261: CF435B. Pasha Maximizes

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Pasha Maximizes

题意翻译

有一个长度为$n$的正整数。可以对这个数进行交换相邻两个数位的操作。最多能进行$k$次这样的操作,问能得到的最大的数是多少。

题目描述

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

Input

题意翻译

有一个长度为$n$的正整数。可以对这个数进行交换相邻两个数位的操作。最多能进行$k$次这样的操作,问能得到的最大的数是多少。

加入题单

上一题 下一题 算法标签: