#D2983. 1333
1333
1333
Problem
Given the string of length . Process the following query times.
Query Let be a character string consisting of from the character to the character (including both ends). Represent as using the appropriate strings With that in mind, it prints the length of the longest of such . However, if such does not exist, 0 is output instead.
Constraints
The input satisfies the following conditions.
- Each letter of consists of a lowercase alphabet
Input
The input is given in the following format.
are all given as integers. and are given on the first line, separated by blanks. The string is given on the second line. 2 + L_i R_i line separated by blanks. These represent in the th query.
Output
Print the longest length on a single line for each query.
Examples
Input
12 3 itisansansan 1 12 5 12 6 7
Output
2 1 0
Input
20 2 sensanbyakusanjuusan 1 20 1 14
Output
3 1
Input
21 6 aaaabaaaabaaaaaaaaaab 1 21 10 21 10 18 4 16 11 21 1 6
Output
4 0 2 2 0 1
inputFormat
outputFormat
output instead.
Constraints
The input satisfies the following conditions.
- Each letter of consists of a lowercase alphabet
Input
The input is given in the following format.
are all given as integers. and are given on the first line, separated by blanks. The string is given on the second line. 2 + L_i R_i line separated by blanks. These represent in the th query.
Output
Print the longest length on a single line for each query.
Examples
Input
12 3 itisansansan 1 12 5 12 6 7
Output
2 1 0
Input
20 2 sensanbyakusanjuusan 1 20 1 14
Output
3 1
Input
21 6 aaaabaaaabaaaaaaaaaab 1 21 10 21 10 18 4 16 11 21 1 6
Output
4 0 2 2 0 1
样例
12 3
itisansansan
1 12
5 12
6 7
2
1
0
</p>