Examples:
Input: "hello python program how are you" Output: are hello how program python you Input: "Coders loves the algorithms" Output: Coders algorithms loves the
Note: words that have the first letter are capital letters and will be printed in alphabetical order.
Match:
The approach used in this program is very simple. Split the lines using the split () function. After that, sort the words in lexicographic order using sort (). Repeat words in a loop and print each word that is already sorted.
|
Output:
alphabetical example hello how in is manner sort the this to word