Counting number of sentences and words in text
Easy Accuracy: 22.96% Submissions: 205 Points: 2

Given a text. The task is to count number of sentences and words in text. 

Definition of a sentence :- Sentences are defined as contiguous strings of characters ending in an  end of sentence punctuation (. ! or ?) or the last contiguous set of characters in the string, even if they don't end with a punctuation mark.

Definition of a word :- "Words" are defined as contiguous strings of alphabetic characters  i.e. any upper or lower case characters a-z or A-Z

Input: 
The first line contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of a single line which contains a text.

Output:
Corresponding to each test case, print space separated number of sentences and words.

Constraints:
1 <=T<= 100
0 <=  |text| <= 250

where |text| denoted the length of text

Example:
Input:
3
Sentences

many??? Sentences are


Output:
1 1
0 0
2 3

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.