code:-
mystring=input("Enter a string\n")
mylist=mystring.split()
mylist.sort()
mystring=''
for i in mylist:
mystring=mystring+' '+i
print("sorted string- ",mystring)
Output:-
Enter a string
this is easy coding zone
sorted string- coding easy is this zone
1 Comments
Good 👍
ReplyDelete