Question: Write a python program that reads strings (without digits or symbols in the string) typed by the user until an empty string is entered. For

Write a python program that reads strings (without digits or symbols in the string) typed by the user until an empty string is entered. For each string, convert all words to lowercase, then sort and print the words into descending order lexicographically.

Output should be like this:

Enter a string: Three Rings for the eleven kings under the sky

Output: under three the the sky rings kings for eleven

Enter a string: Seven for the Dwarf lords in their halls of stone

Output: their the stone seven of lords in halls for dwarf

Enter a string: Nine for Mortal Men doomed to die

Output: to nine mortal men for doomed die

Enter a string: One for the Dark Lord on his dark throne

Output: throne the one on lord his for dark dark

Enter a string: In the land of Mordor where the Shadows lie

Output: where the the shadows of mordor lie land in

Step by Step Solution

3.30 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program while True a inputEnter a string or press enter to Quit need to enter the string given in qu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!