Question: Given a number and a digit on one line, insert the digit into the number in front of the first digit in the number that

Given a number and a digit on one line, insert the digit into the number in front of the first digit in the number that is less than the given digit. For example:
If given 65432 and 3 as inputs, the 3 would be inserted after the 4 in the number, to create the new number: 654332.
The first (and only) line of input contains n, the string representation of the number and d, the digit to insert. It is guaranteed that n will not have any leading zeros.
Output the largest number that can be created by inserting d into n. Write the code in python pls.
 Given a number and a digit on one line, insert the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!