P2264 Love Letter
Background
A good love letter requires the writer’s wholehearted devotion. Student CYY has a crush on the cute c** and wants to confess to her, but he doesn’t know whether his love letter can move her. Now he brings the letter to you for help.
Description
To help CYY, we define a quantitative standard called the touching value to evaluate the quality of a love letter. The rules for determining the touching value are as follows:
1. In a sentence of the love letter, if it contains a specific word from the given vocabulary list, the touching value increases by 1. However, multiple occurrences of the same word in the same sentence do not stack. Different words are not affected by each other. It is guaranteed that the input words are not duplicated.
2. Each sentence is delimited by an English period.
3. Matching is case-insensitive throughout the text.
4. A sentence may contain English quotation marks or apostrophes, for example ```you're```.
Input Format
The first line contains a number $n$, the number of words in the vocabulary list that increase the touching value. The next $n$ lines contain the given words, one per line. It is guaranteed that each word contains only English letters.
The last line is the full text of the love letter. It is guaranteed to contain only the following characters: English letters, digits, spaces, English commas, English periods, and English quotation marks.
Output Format
A single number $g$, representing the touching value contributed by the love letter.
Explanation/Hint
Constraints: For all testdata, it is guaranteed that $1 \le n \le 100$, each word is at most $50$ characters long, and the full text is at most $1000$ characters long.
Translated by ChatGPT 5