You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict size_A, size_B = map(int, input().split()) occurrences: dict[str, list[int]] = defaultdict(list) for i in range(size_A): word_A = input() occurrences[word_A].append(i + 1) for _ in range(size_B): word_B = input() if word_B in occurrences: print(*occurrences[word_B]) else: print(-1)
Seems like cookies are disabled on this browser, please enable them to open this website
DefaultDict Tutorial
You are viewing a single comment's thread. Return to all comments →