| SanSi Cup 2023 |
|---|
| Закончено |
Given $$$n$$$ dictionary words and $$$q$$$ questions, for each question, answer the following:
The first line contains an integer $$$n$$$ $$$(1 \le n \le 10^5)-$$$ the number of dictionary words.
Each of the following $$$n$$$ lines contains a word $$$d_i$$$ $$$(1 \le |d_i| \le 5; 1 \le i \le n)$$$, consisting of lowercase Latin letters, and it is guaranteed that all these words are distinct from each other.
The next line contains an integer $$$q$$$ $$$(1 \le 10^5)-$$$ the number of questions.
Each of the following $$$q$$$ lines contains the information of each question, a word $$$s_i$$$ composed of lowercase Latin letters and an integer $$$k_i$$$ $$$(1 \le |s_i| \le 5; 1 \le k_i \le 10^5; 1 \le i \le q)$$$.
It is guaranteed that the total size of the dictionary words does not exceed $$$5*10^5$$$. Similarly, it is guaranteed that the total size of the question words does not exceed $$$5*10^5$$$.
For each question, print the answer.
4vacabacaholaabola6a 1a 3a 4a 5lola 2ahaca 1
4 3 1 -1 3 2
| Название |
|---|


