#P6640. [BJOI2020] 封印
[BJOI2020] 封印
Background
Note: The NOI 2020 Beijing team selection was canceled due to force majeure, and the provincial team was selected based on the previous year's CSP-S Round 2 results. Because there were ties, an additional test was held to decide the final Team A list. This problem is the additional test problem.
Problem Description
Given two strings that contain only lowercase letters , there are queries. In each query, ask for the length of the longest common substring of and .
Input Format
The input has lines.
The first line contains a string .
The second line contains a string .
The third line contains an integer .
The next lines each contain two integers , representing one query.
Output Format
Output has lines.
The -th line is the length of the longest common substring of and .
aaba
aaaabbbaa
3
1 4
1 3
2 4
3
3
2
Hint
| Test Point ID | ||
|---|---|---|
Translated by ChatGPT 5