{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"给定一个串,每次询问l~r组成的子串的不同子串个数"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains integer T(1\u0026lt;\u003dT\u0026lt;\u003d5), denote the number of the test cases. \n\u003cbr\u003e For each test cases,the first line contains a string s(1 \u0026lt;\u003d length of s \u0026lt;\u003d 2000). \n\u003cbr\u003e Denote the length of s by n. \n\u003cbr\u003e The second line contains an integer Q(1 \u0026lt;\u003d Q \u0026lt;\u003d 10000),denote the number of queries. \n\u003cbr\u003e Then Q lines follows,each lines contains two integer l, r(1 \u0026lt;\u003d l \u0026lt;\u003d r \u0026lt;\u003d n), denote a query."}},{"title":"Output","value":{"format":"HTML","content":"For each test cases,for each query,print the answer in one line."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\nbbaba\n5\n3 4\n2 2\n2 5\n2 4\n1 4\nbaaba\n5\n3 3\n3 4\n1 4\n3 5\n5 5\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e3\n1\n7\n5\n8\n1\n3\n8\n5\n1\n\n \n \u003ci style\u003d\"font-size:1px\"\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003e\n I won\u0027t do anything against hash because I am nice.Of course this problem has a solution that don\u0027t rely on hash.\n\n \n \u003c/pre\u003e"}}]}