Digit Problem

3.9

280 votes
Approved, Basic Programming, Easy
Problem

This time your task is simple.

Given two integers X and K, find the largest number that can be formed by changing digits at atmost K places in the number X.

Input:

First line of the input contains two integers X and K separated by a single space.

Output:

Print the largest number formed in a single line.

Constraints:

  • 1X1018
  • 0K9

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

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

Editor Image

?