{"trustable":true,"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":"\u003cdiv class\u003d\"panel_content\"\u003eThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter \u0027e\u0027. He was a member of the Oulipo group. A quote from the book:\u003cbr\u003e\u003cbr\u003eTout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair normal, d’abord, puis surgissait l’inhumain, l’affolant. Il aurait voulu savoir où s’articulait l’association qui l’unissait au roman : stir son tapis, assaillant à tout instant son imagination, l’intuition d’un tabou, la vision d’un mal obscur, d’un quoi vacant, d’un non-dit : la vision, l’avision d’un oubli commandant tout, où s’abolissait la raison : tout avait l’air normal mais…\u003cbr\u003e\u003cbr\u003ePerec would probably have scored high (or rather, low) in the following contest. People are asked to write a perhaps even meaningful text on some subject with as few occurrences of a given “word” as possible. Our task is to provide the jury with a program that counts these occurrences, in order to obtain a ranking of the competitors. These competitors often write very long texts with nonsense meaning; a sequence of 500,000 consecutive \u0027T\u0027s is not unusual. And they never use spaces.\u003cbr\u003e\u003cbr\u003eSo we want to quickly find out how often a word, i.e., a given string, occurs in a text. More formally: given the alphabet {\u0027A\u0027, \u0027B\u0027, \u0027C\u0027, …, \u0027Z\u0027} and two finite strings over that alphabet, a word W and a text T, count the number of occurrences of W in T. All the consecutive characters of W must exactly match consecutive characters of T. Occurrences may overlap.\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input file contains a single number: the number of test cases to follow. Each test case has the following format:\u003cbr\u003e\u003cbr\u003eOne line with the word W, a string over {\u0027A\u0027, \u0027B\u0027, \u0027C\u0027, …, \u0027Z\u0027}, with 1 ≤ |W| ≤ 10,000 (here |W| denotes the length of the string W).\u003cbr\u003eOne line with the text T, a string over {\u0027A\u0027, \u0027B\u0027, \u0027C\u0027, …, \u0027Z\u0027}, with |W| ≤ |T| ≤ 1,000,000.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For every test case in the input file, the output should contain a single number, on a single line: the number of occurrences of the word W in the text T.\u003cbr\u003e\u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\nBAPC\r\nBAPC\r\nAZA\r\nAZAZAZA\r\nVERDI\r\nAVERDXIVYERDIAN\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n3\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}