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
- Sort the words in lexicographical order in Python
- Sort an array of string of dates in ascending order
- Sort all even numbers in ascending order and then sort all odd numbers in descending order
- Sort first k values in ascending order and remaining n-k values in descending order
- Python | Check if given words appear together in a list of sentence
- Python program to count words in a sentence
- Python | Remove all duplicates words from a given sentence
- Python | Spilt a sentence into list of words
- Sort first half in ascending and second half in descending order | Set 2
- Sort first half in ascending and second half in descending order | 1
- Sorting rows of matrix in ascending order followed by columns in descending order
- Sorting rows of matrix in descending order followed by columns in ascending order
- Python | Sort Tuples in Increasing Order by any key
- Print number in ascending order which contains 1, 2 and 3 in their digits.
- Sorting of Vector of Tuple in C++ (Ascending Order)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.