Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def swap(A,i,j):
- a=A[i]
- A[i]=A[j]
- A[j]=a
- def bubblesort(A):
- n=len(A)-1
- for i in range(n-1):
- for j in range(n-i):
- if A[j]>A[j+1]:
- swap(A,j,j+1)
- def tr(a):
- b=0
- while a!=0:
- a=a//10
- b=b+1
- return b
- a=int(input())
- b=tr(a)
- A=b*[0]
- for i in range(b):
- A[i]=a//10**i%10
- bubblesort(A)
- c=0
- for i in range(b):
- c=c+A[i]*10**i
- print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement