Chandler after finding the his nubbin is struck by a question of answering the queries asked by his nubbins. First he gets a string S consisting of alphanumeric characters and then Q queries. Each query is a non-empty string of alphanumeric characters P. For each such P, Chandler has to tell how many P's can be formed using the elements of S.
Note : The string has both Lower and Upper case characters.
Input:
The first line of input contain a string S,
Next line contains an integer Q - number of queries.
Each of the next Q lines contain a string P.
Output:
For each query output the required answer.
Constraints:
1≤|S|≤105
1≤∑|P|≤105
1≤Q≤105
Problem Setter - Saurabh