Matches
Many people have enjoyed solving matchstick puzzles, where the challenge is to rearrange a certain number of matches to achieve a specified result.
Typically, the numbers in these puzzles are represented like this:
Unfortunately, there aren't many of these puzzles readily available, but creating them isn't too difficult. Let's explore a problem where, starting from a given number N, you need to rearrange no more than K matches to form the largest possible number.
In these puzzles, you can start with any number, and the main task is to find the correct solution. This is the challenge you need to tackle.
Input
The input consists of a single line with two integers: N – the initial number formed by matches (0 ≤ N < 10^10000), and K – the maximum number of matches you can rearrange (1 ≤ K ≤ 100).
Output
Output a single integer on one line – the largest number that can be formed from the initial number N by rearranging no more than K matches. The number of digits in the result may change, but there should be no gaps (spaces between digits) in the final number.