DefaultDict Tutorial

  • + 0 comments
    A=[]
    B=[]
    
    n, m = list(map(int, input().split()))
    for _ in range(n):
        word=input()
        A.append(word)
        
    for _ in range(m):
        word=input()
        if word in A:
            for i in range(len(A)):
                if word == A[i]:
                    print(i+1, end=" ")
        else:
            print(-1,end=" ")
        print()
       
    

    `