luogu#P8571. [JRKSJ R6] Dedicatus545
[JRKSJ R6] Dedicatus545
Background

Problem Description
For strings , define as the number of occurrences of in .
Index gives you strings and queries. Each query provides . You need to compute .
Input Format
The first line contains two integers .
The next lines each contain a string consisting only of lowercase letters, representing .
The next lines each contain three integers , representing a query.
Output Format
For each query, output one integer per line representing the answer.
6 3
dedicatus
a
misaka
mikoto
mi
aaa
1 5 6
1 2 4
1 5 4
3
0
1
Hint
Constraints
This problem uses bundled testdata.
| Special property | ||||
|---|---|---|---|---|
| None | ||||
| All strings are pairwise distinct | ||||
| None |
For of the data, , , , .
Data: abruce&critnos&fjy666
Translated by ChatGPT 5