DefaultDict Tutorial

  • + 0 comments

    I know I didnt use defaultdict but I cannot figure out why this code is failing test cases 1,2,3 and 4. Can anyone help me figure out?

    n,m = map(int,input().split()) A = list() B = list()

    for i in range(n): A.append(input()) for i in range(m): B.append(input())

    for i in range (m): count = 0 for j in range(n): if B[i] == A[j]: print(j+1, end = ' ') count += 1 if count == 0: print(-1) print()