#K1601. Count the Contractions in a Document
Count the Contractions in a Document
Count the Contractions in a Document
This problem requires you to count the number of contractions in a given document. A contraction is defined as any word that contains the apostrophe character ('). You will be given an integer n on the first line representing the number of lines in the document, followed by n lines of text.
Your task is to output a single integer which is the total count of words containing an apostrophe. For example, in the sentence "don't stop now", the word "don't" is counted as a contraction.
Note: The input will be read from stdin
and the output should be printed to stdout
.
inputFormat
The first line of input contains a single integer n
indicating the number of lines in the document. The next n
lines each contain a string potentially containing words with contractions.
Example:
3 don't stop now I'll be there we're not done yet
outputFormat
Output a single integer indicating the total number of contractions found in the document.
For the above example, the output should be:
3## sample
3
don't stop now
I'll be there
we're not done yet
3