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 program to count words in a sentence
- Python | Spilt a sentence into list of words
- Python | Check if given words appear together in a list of sentence
- Python | Remove all duplicates words from a given sentence
- Sort first half in ascending and second half in descending order | 1
- Sort first half in ascending and second half in descending order | Set 2
- Sorting rows of matrix in descending order followed by columns in ascending order
- Sorting rows of matrix in ascending order followed by columns in descending order
- Python | Sort Tuples in Increasing Order by any key
- Sorting of Vector of Tuple in C++ (Ascending Order)
- Print number in ascending order which contains 1, 2 and 3 in their digits.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.
Improved By : shubham_singh