Consider n a strictly positive integer and c a decimal digit.
Task
Write a program that determines the largest and the smallest numbers that can be obtained by inserting digit c into number n.
Input Data
Input file nr.in contains on the first line positive integer n and digit c, separated by a space.
Output Data
Output file nr.out will contain two lines. The first line will contain the largest number that can be obtained by inserting digit c in number n. The second line will contain the smallest number that can be obtained by inserting digit c in number n.
Constraints
nr.in | nr.out |
372 5 |
5372 |
Time limit: 0.1 seconds/test
prof. Marinel Serban
Computer Science High
School "Grigore Moisil" Iasi
Contact:marinel_serban@yahoo.com