reorder of string
eren wants to modify a string. the string can contain only positive integers. he wants to change the string in such a way thet the smaller numbers should appear before the bigger numbers.
given string write a program to help eren to modify the string.
import re
input1 = input('')
numbers = tuple(sorted(map(int, re.findall(r'([\d]+)', input1)), reverse=True))
inpPlaceholders = re.sub(r'([\d]+)', '%s', input1)
print(inpPlaceholders % numbers)
Comments
Leave a comment