earrange Numbers in String Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part. Input The input will be a single line containing a string.
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
Input
The input will be a single line containing a string.
Output
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
Explanation
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
sample input:
I am 5 years and 11 months old
sample output:
I am 11 years and 5 months old
Note: please solve this question along with hidden test case
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images