#P6882. [COCI 2016/2017 #3] Imena
[COCI 2016/2017 #3] Imena
Problem Description
A word is a string made of uppercase or lowercase letters. In particular, it may also end with a punctuation mark (., ?, !). A name is a word whose first letter is uppercase, and only the first letter is uppercase.
A sentence is a string made of some words, and its last character is a punctuation mark (., ?, !).
Given sentences, Mirko wants you to count how many names there are in each sentence.
Input Format
The first line contains a positive integer , the number of sentences.
The second line contains these sentences. The total number of characters of these sentences does not exceed .
Output Format
Output lines, each containing one positive integer. The -th line should contain the total number of names in the -th sentence.
1
Spavas li Mirno del Potro Juan martine?
4
2
An4 voli Milovana. Ana nabra par Banana.
1
2
Hint
Sample Explanation
Sample 2 Explanation
In the first sentence, the only name is Milovana, so there is in total. In the second sentence, the names are Ana and Banana, so there are in total. Note that in the first sentence, although An4 starts with an uppercase letter, it contains a digit, so it is not a name.
Constraints
For of the testdata, .
For of the testdata, .
Notes
This problem is translated from COCI2016-2017 CONTEST #3 T1 Imena.
Translated by ChatGPT 5