HZNUOJ

God and Goddess I

Tags:
Time Limit:  1 s      Memory Limit:   32 MB
Submission:32     AC:2     Score:99.75

Description

As we know, CJC and LOY are the god and goddess in our ACM Team.

One day, they get a long text which is consisted of lowercase alphabets from the outer space. Goddess LOY wonders is our teammates’ names appear in this text and how many times they appeared, so she asks God CJC to find them. Unfortunately, the text is too long, God CJC can hardly find them by eyes, but he cannot lose faces in front of his goddess, either.

To keep the faces of God CJC, please help him.

Input

The first line is the number test cases T (1 <= T <= 20).

The first line of each test case is a long text which is no more than 2000000 lowercase characters.

The second line of each test case is a number n (1 <= n <= 100).

The third line of each test case is n different strings, indicates the names of our teammates, all of them are consisted of lowercase characters and no more than 100 characters. There is a space between each strings.

Output

Output “Case i:#” for each test case (“i” is the order of current test case).

Output appeared times of each teammates’ name (with input order). There is a blank line after each test case. See the sample for more details.

Samples

input
3 cjclovesloybutloydoesnotlovecjcloylovesvigossbutvigosshasgirlfriendalreadyvigosshasmanymonkeysbecausevigosslovescjc 4 cjc loy vigoss wly zhenglingisunhappybecausewzjdoesnotlovehimatallzhenglinghateswxabecausehehastheidenticallastnamewithwk 4 zhengling wzj wxa wk ylandydwgotofinalsbutydwsleepsallthetimeydwsaidsjyisimportantforhimbutsjydislikehimbecauseydwneverbathing 3 yl ydw sjy
output
Case 1:# cjc:3 loy:3 vigoss:4 wly:0 Case 2:# zhengling:2 wzj:1 wxa:1 wk:1 Case 3:# yl:1 ydw:4 sjy:2

Author

CHEN, Yupeng