Question: WRITE USING C LANGUAGE You would like to find the sentence containing the largest number of words in some given text. The text is specified

WRITE USING C LANGUAGE

WRITE USING C LANGUAGE You would like to find the sentence containingthe largest number of words in some given text. The text is

You would like to find the sentence containing the largest number of words in some given text. The text is specified as a string S consisting of N characters: letters, spaces, dots (.), question marks (?) and exclamation marks (!). The text can be divided into sentences by splitting it at dots, question marks and exclamation marks. A sentence can be divided into words by splitting it at spaces. A sentence without words is valid, but a valid word must contain at least one letter. For example, given S = "We test coders. Give us a try?" there are three sentences: "We test coders","Give us a try" and "". The first sentence contains three words: "We", "test" and "coders". The second sentence contains four words: "Give", "us", "a" and "try". The third sentence is empty. Write a function: class Solution { public int solution(String 5); } that, given a string S consisting of N characters, returns the maximum number of words in a sentence. 11 Write a function: class Solution { public int solution(String 5); } Tes that , given a string S consisting of N characters, returns the maximum number of words in a sentence. For example, given S = "We test coders. Give us a try?", the function should return 4, as explained above. Given S = "Forget CVs.. Save time . x x", the function should return 2, as there are four sentences: "Forget CVs" (2 words), " (0 words), "Save time "(2 words) and" x x" (2 words)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!