{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter \u003ctt\u003e\u0027e\u0027\u003c/tt\u003e. He was a member of the Oulipo group. A quote from the book:\u003c/p\u003e\u003cblockquote\u003e\u003cp\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…\u003c/p\u003e\u003c/blockquote\u003e\u003cp\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 \u003ctt\u003e\u0027T\u0027\u003c/tt\u003es is not unusual. And they never use spaces.\u003c/p\u003e\u003cp\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 {\u003ctt\u003e\u0027A\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027B\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027C\u0027\u003c/tt\u003e, …, \u003ctt\u003e\u0027Z\u0027\u003c/tt\u003e} and two finite strings over that alphabet, a word \u003ci\u003eW\u003c/i\u003e and a text \u003ci\u003eT\u003c/i\u003e, count the number of occurrences of \u003ci\u003eW\u003c/i\u003e in \u003ci\u003eT\u003c/i\u003e. All the consecutive characters of W must exactly match consecutive characters of \u003ci\u003eT\u003c/i\u003e. Occurrences may overlap.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input file contains a single number: the number of test cases to follow. Each test case has the following format:\u003c/p\u003e\u003cul\u003e\u003cli\u003eOne line with the word \u003ci\u003eW\u003c/i\u003e, a string over {\u003ctt\u003e\u0027A\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027B\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027C\u0027\u003c/tt\u003e, …, \u003ctt\u003e\u0027Z\u0027\u003c/tt\u003e}, with 1 ≤ |\u003ci\u003eW\u003c/i\u003e| ≤ 10,000 (here |\u003ci\u003eW\u003c/i\u003e| denotes the length of the string \u003ci\u003eW\u003c/i\u003e).\u003c/li\u003e\u003cli\u003eOne line with the text \u003ci\u003eT\u003c/i\u003e, a string over {\u003ctt\u003e\u0027A\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027B\u0027\u003c/tt\u003e, \u003ctt\u003e\u0027C\u0027\u003c/tt\u003e, …, \u003ctt\u003e\u0027Z\u0027\u003c/tt\u003e}, with |\u003ci\u003eW\u003c/i\u003e| ≤ |\u003ci\u003eT\u003c/i\u003e| ≤ 1,000,000.\u003c/li\u003e\u003c/ul\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor 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 \u003ci\u003eW\u003c/i\u003e in the text \u003ci\u003eT\u003c/i\u003e.\u003c/p\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\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n3\r\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}