Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programming EASY-1 Write a program that reads a sentence The words in a sentence are separated by a space ( ). Print the following

image text in transcribed

image text in transcribed

image text in transcribed

python programming

EASY-1 Write a program that reads a sentence The words in a sentence are separated by a space (" "). Print the following on each line. 1. The total number of words in the sentence 2. The number of times the most repeated word appears in the sentence 3. The longest word in the sentence S. If the longest words are more than 1 , print the first longest word that appears in a sentence S. - A letter in uppercase and lowercase is considered to be the same. Example: A and a . Both letters are considered as the same. - The output should contain only lowercase letters when printing the longest word. The input will be a single line containing a string representing the sentence Output The first line of output should be an integer representing the total number of words. The second line of output should be an integer representing the number of times the most repeated word appears. The third line of output should be a string representing the longest word. If the longest words are more than 1 , the output represents the first longest word. Constraints The sentence S given as input will always contain one most repeated word. Explanation For example, if the given sentence S is "She plays carroms and he plays cricket at their place" - Ine totar number or woras in the sentence is IU. - The most repeated word is "plays". It is repeated 2 times. - The longest words are "carroms" and "cricket" with length 7. The first longest word is "carroms". The output should be, Sample Output 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Psychological, financial, and career counseling.

Answered: 1 week ago