Skip to content

Commit

Permalink
Create DefaultDictionary.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansumanbhujabal authored May 2, 2024
1 parent fb8480e commit 988acc5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Python_Problems/DefaultDictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Enter your code here. Read input from STDIN. Print output to STDOUT
from collections import defaultdict
n,m = map(int,input().split())
d = defaultdict(list)
for i in range(n):
ans1=input()
d[ans1].append(i+1)
for j in range(m):
ans2=input()
if ans2 in d:
print(*d[ans2])
else:
print(-1)

0 comments on commit 988acc5

Please sign in to comment.