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