Shift Numbers - 2
Given a string, write a program to move all the numbers in it to its start.Input
The input will contain a string A.Output
The output should contain a string after moving all the numbers in it to its start.Explanation
For example, if the given string A is "1good23morning456", the output should be "123456goodmorning", as it contains numbers at the start.
Sample Input 1
1good23morning456
Sample Output 1
123456goodmorning
Sample Input 2
com876binat25ion
Sample Output 2
87625combination
user_string =input("");
integers=""
letters=""
# Looping through a string.
for l in user_string:
if (l.isdigit()):
integers+=l
else:
letters+= l
# Display result.
print(integers+letters)
Comments
Leave a comment