A white rabbit wants to send one word to a black rabbit without letting any other rabbit find out which word it is. The two rabbits agreed on a scheme beforehand, and the white rabbit handed the black rabbit the full list of words it knows. When the white rabbit sends a word, it mixes many other letters in front of the word, behind it, and around it, and sends the whole thing as one long message.
For a message, find every word on the list that occurs in the message as a contiguous substring. If exactly one distinct word occurs, that word is the one the white rabbit meant to send. Help the black rabbit answer for each message.
The first line has the number of test cases T (1≤T≤2). Each test case has the following form.
Print one line for each message. First count the distinct words the white rabbit knows that occur in the message as a contiguous substring.