Tyrion and Jaime

0

0 votes
Easy
Problem

Tyrion Lannister and Jaime Lannister are playing a game of number. Jaime will give two numbers X and K to Tyrion to find the largest number that can be formed by changing digits at most K places in the number X.

Input :

The first line contains two space-separated integers X and K.

Output :

Print the largest number formed in a single line.

Constraints :

  • 1 <= X <= 1018
  • 0 <= K <= 9
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

First two digits of the number are changed to get the required number.

Editor Image

?