DEV Community

Anil
Anil

Posted on

Sorting numbers in a string containing combination of both alphanumeric

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. The input will be a single line containing a string. The output should be a single line containing the modified string re-ordered in decreasing order.

Expected input1 - I am 5 years and 11 months old Expected output1- I am 11 years and 5 months old Expected input2 - 3 into4 equal 12 Expected output2 - 12 into 4 equals3 The code I wrote

Top comments (0)