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