You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict n, m = map(int, input().split()) d = defaultdict(list) for i in range(n): s = input().rstrip() d[s].append(i+1) for j in range(m): s = input().rstrip() if s in d: print(' '.join(map(str,d[s]))) 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 →