You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict
x,y = input().split() B = []
A = defaultdict(list)
for i in range(int(x)): a= input() A[a].append(i+1)
for j in range(int(y)): b= input()
if(b in A.keys()): [print(z,end=" ") for z in A[b]] else: print(-1)
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
DefaultDict Tutorial
You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict
x,y = input().split() B = []
A = defaultdict(list)
for i in range(int(x)): a= input() A[a].append(i+1)
for j in range(int(y)): b= input()