Longest sentence
A paragraph is made of sentences that end with a full stop, question mark or exclamation mark. Print the number of words in the longest sentence.
Reported in: TCS NQT (memory-based)
Input
One line: the paragraph.
Output
The word count of the longest sentence.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
We met. It was a long and happy day! Bye.
Output:
7Example 2
Input:
One sentence only
Output:
3Hint: Split on . ? ! and count the words in each piece.