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 2
123456goodmorning
sample input 2
com876binat25ion
sample output 2
87625combination
A = input()
D = []
C = []
for c in A:
if '0' <= c <= '9':
D.append(c)
else:
C.append(c)
s = ''.join(D) + ''.join(C)
print(s)
Comments
Leave a comment