Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('input.txt', 'r') as InputFile:
- R = InputFile.read()
- R= int(R)
- First = (R//1000)%10
- Second = (R//100)%10
- Third =(R//10)%10
- Fourth = R%10
- i=0
- while (i<5):
- if(First>Second and Second>0):
- a=First
- First=Second
- Second= a
- elif (Second>=Third ):
- a=Second
- Second= Third
- Third= a
- elif(Third>=Fourth):
- a= Third
- Third = Fourth
- Fourth = a
- i+=1
- First= str(First);Second= str(Second);Third= str(Third);Fourth= str(Fourth);
- with open('output.txt', 'w') as OutputFile:
- OutputFile.write(First+Second+Third+Fourth)
Advertisement
Add Comment
Please, Sign In to add comment