Write a program to accept a paragraph containing exactly two sentences. The sentences may be terminated by
either “.” or “?” or “!” only. Now do the following operation on the paragraph and display the output in the
given format. For invalid form of input, the program must display appropriate message.
1. Print the number of words in each sentence.
2. Print the longest word (as per length) in each sentence
Java Program
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Thomas
13 September 2022, 16:51
Yep, did that. Now what?
>>> This is some sample input. No error thrown as the second sentence ends with a question mark?
Sentence 1:
Number of words: 5
Longest word in this sentence: sample
Sentence 2:
Number of words: 12
Longest word in this sentence: sentence
0