All Tracks Basic Programming Implementation Basics of Implementation Problem

Digit Problem
Tag(s):

Basic Programming, Very-Easy

Problem
Editorial
Analytics

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:

  • $$1\le X \le 10^{18}$$
  • $$0 \le K \le 9$$

SAMPLE INPUT
4483 2
SAMPLE OUTPUT
9983
Explanation

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

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala 2.11.8, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

December Easy '16

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications