Problem I. Reincarnation
时间限制 3000 ms
内存限制 64 MB
Now you are back,and have a task to do:
Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s.
And you have some query,each time you should calculate f(s[l...r]), s[l...r] means the sub-string of s start from l end at r.
输入数据
输出数据
For each test cases,for each query,print the answer in one line.
样例输入
复制
2
bbaba
5
3 4
2 2
2 5
2 4
1 4
baaba
5
3 3
3 4
1 4
3 5
5 5
样例输出
样例说明
I won't do anything against hash because I am nice.Of course this problem has a solution that don't rely on hash.
$ Mathjax font initiator $