Sub Sub Strings


You are given a string ss of length nn, and must answer qq queries.

Each query gives a range [a,b][a, b] and asks for the length of the longest contiguous substring inside sasa+1…sbs_a s_{a + 1} \ldots s_b that consists of only one repeated character.

For example, given the string aaabbbb and the interval [2,7][2, 7], the longest such substring is bbbb, which has length 44.

Positions are 1-indexed.

Input

The first line contains the integers nn and qq.

The second line contains the string ss.

Each of the next qq lines contains two integers aa and bb.

Output

For each query, output a line containing the answer.

Constraints

  • 1≤n≤1051 \le n \le 10^5
  • 1≤q≤1041 \le q \le 10^4
  • 1≤a≤b≤n1 \le a \le b \le n
  • ss consists only of lowercase English letters.

Example 1

Input 1
20 10
aaaddddccccaaabbbccc
4 9
2 13
13 17
2 8
18 20
18 19
6 7
3 16
17 18
17 19
Output 1
4
4
3
4
3
2
2
4
1
2

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.