Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(list)
for i in range(n):
d[input()].append(i+1)
for j in range(m):
s = input()
if s in d:
print(*d[s])
else:
print(-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment