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 _ in range(n): d['A'].append(input().strip()) for _ in range(m): d['B'].append(input().strip()) for item in d['B']: positions = [i+1 for i, val in enumerate(d['A']) if val.strip().lower() == item.lower()] if positions: print(*positions) 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 →