URI Online Judge | 2594

Eachians II

By Victor Jatobá and Ariane Machado, USP BR Brazil

Timelimit: 4

The Eachians are still worried after They found out a new bomb and received a mount of texts from the neighboring planet. They still suspect that there is a pattern in the number represented by a word position in the text. These positions together, they say, represents a key to deactivate a bomb that is about to explode the EACH planet.

You were then summoned to developing a program that receive a set of a little texts followed by the words and the program need to return the first position of each word that is present in each text.

Constraints:

Input

The input need be, exactly:

Output

For each pair of text and word, the program must print the position of the first letter present in the text. Mind that the words can be repeated in the text. In this instance, the positions must be printed one in front of other, separated with whitespaces. If the text doesn’t contain the word, return -1 (the number minus one).

Input Samples Output Samples

3
see a bear sell stock see a bull buy stock bid stock bid stock hear the bell
bear
see a bear sell stock see a bull buy stock bid stock bid stock hear the bell
bid
see a bear sell stock see a bull buy stock bid stock bid stock hear the bell
hear

6
43 53
63

3
lorem ipsum dolor sit amet
ipsum
meis illum nec at summo cetero et usu adhuc justo tacimates cum et sint pericula mei eu pri ipsum eruditi periculis an no
meis

aaaa

aa

6
0
-1