Problem B. Problem B. Cut The String
时间限制 3000 ms
内存限制 512 MB
A string is palindromic if it reads the same from left to right.
Given a string $S[1..n]$, Little Q will ask you $m$ queries. For each query, Little Q will give you $2$ integers $l_i,r_i$, you need to find the number of ways to cut the continous substring $S[l_i..r_i]$ into two non-empty palindromic strings. That is, find the number of $k(l_i\leq k<r_i)$ satisfying $S[l_i..k]$ and $S[k+1..r_i]$ are both palindromic strings.
输入数据
输出数据
For each query, print a single line containing an integer, denoting the answer.
样例输入
复制
1
10 5
aaaabababb
1 4
1 5
4 9
6 10
1 10
样例输出
$ Mathjax font initiator $