You are given two strings $$$a$$$ and $$$b$$$, where $$$a$$$ has length $$$n$$$ and $$$b$$$ has length $$$m$$$.
For a string $$$c$$$, define $$$f(c)$$$ as the number of distinct integers $$$k$$$ ($$$1 \leq k \leq |c|$$$) such that every $$$k$$$-length contiguous substring of $$$c$$$ is also a contiguous substring of $$$a$$$.
Your task is to answer $$$q$$$ queries. In each query, you are given two integers $$$l$$$ and $$$r$$$, and you need to compute $$$f(b[l:r])$$$, where $$$b[l:r]$$$ denotes the contiguous substring of $$$b$$$ starting at index $$$l$$$ and ending at index $$$r$$$.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$) — the number of test cases.
The first line of each test case contains three integers $$$n$$$, $$$m$$$, and $$$q$$$ ($$$1 \leq n, m \leq 4 \cdot 10^5$$$, $$$1 \leq q \leq 10^6$$$) — the lengths of strings $$$a$$$ and $$$b$$$, and the number of queries.
The second line contains the string $$$a$$$ of length $$$n$$$ consisting of lowercase English letters.
The third line contains the string $$$b$$$ of length $$$m$$$ consisting of lowercase English letters.
Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq m$$$).
It is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases does not exceed $$$4 \cdot 10^5$$$, and the sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$.
For each query, output a single integer — the value of $$$f(b[l:r])$$$.
25 5 3abdbccabce2 45 53 42 3 1aaabc1 1
2 0 2 1
In the first test case, for the first query, we have $$$a = $$$ abdbc and $$$c = b[2:4] = $$$ abc. Here,
| Название |
|---|


