Problem B
Gremlins

Oh no! Ivan had carefully lined up a collection of objects in a certain order along the windowsill of his apartment, but when he got up this morning, he found that gremlins had messed up the order of the objects during the night, and they even stole a few!
Thankfully, Ivan has a list of all the items in the correct order. He needs your help to put the items back in order and figure out which ones are missing!
Input
The first line of input has two space-separated integers $n$ and $m$ ($1\leq n \leq 10^5$, $0 \leq m \leq n$), where $n$ is the original number of items, and $m$ is the number of items there are now.
The next $n$ lines specify Ivan’s list, that is, the names of all the items in their original order. Each item name is on a separate line and may contain capital and lowercase letters, as well as underscores. Each name is at least one and at most $15$ characters long. It is guaranteed that no items will be repeated, that is, all $n$ names will be distinct.
Finally, there are $m$ lines specifying the items on Ivan’s windowsill in their current order. The $m$ names will all be distinct, and each one is guaranteed to be one of the original $n$ names.
Output
Print a sequence of $n$ lines, one for each item in their original order. For each item:
-
If the item is among the $m$ remaining items, print its index in the current order, where $1$ means the item is currently first, $2$ means the item is currently second, and so on.
-
If the item is missing, print stolen!
Sample Input 1 | Sample Output 1 |
---|---|
2 2 socks shoes shoes socks |
2 1 |
Sample Input 2 | Sample Output 2 |
---|---|
2 1 shoes socks shoes |
1 stolen! |
Sample Input 3 | Sample Output 3 |
---|---|
4 3 thing_one thing_two thing_three thing_four thing_two thing_four thing_three |
stolen! 1 3 2 |