Python | Sort words of sentence in ascending order
Given a sentence, sort it alphabetically in ascending order.
Input : to learn programming refer geeksforgeeks Output : geeksforgeeks learn programming refer to Input : geeks for geeks Output : for geeks geeks
- Split the Sentence in words.
- Sort the words alphabetically
- Join the sorted words alphabetically to form a new Sentence.
Below is the implementation of above idea.
geeksforgeeks learn programming refer to for geeks geeks