#P2264. 情书

情书

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 nn, the number of words in the vocabulary list that increase the touching value. The next nn 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 gg, representing the touching value contributed by the love letter.

3
love
so
much
I love you so much.

3

Hint

Constraints: For all testdata, it is guaranteed that 1n1001 \le n \le 100, each word is at most 5050 characters long, and the full text is at most 10001000 characters long.

Translated by ChatGPT 5