A Text Problem

아직 제출이 없습니다시간 제한6초메모리 제한512 MB

문제

The string AA occurs in the string BB at position ii with at most one mistake if and only if either AA occurs in BB at position ii, or there exists a string AA' obtained from AA by replacing the letter at a single position with a different letter such that AA' occurs in BB at position ii.

You are given a string TT and a series of queries. Each query is a string for which you should compute the number of positions at which it occurs in TT with at most one mistake.

입력

The first line of input contains the number of test cases zz. The descriptions of the test cases follow.

The first line of each test case contains a string of length between 11 and 200,000200\\,000 consisting of lowercase Latin letters: the string TT. The next line contains one integer qq: the number of queries. Each of the following qq lines contains a nonempty string consisting of lowercase Latin letters: a query. The sum of lengths of all queries in a test case is at most 200,000200\\,000.

The sum of lengths of all strings appearing in all test cases (including queries) does not exceed 1,200,0001\\,200\\,000.

출력

For each query, output the number of positions in TT at which the query occurs with at most one mistake.