DefaultDict Tutorial

  • + 1 comment
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    len_a, len_b = input().split()
    a, b = list(), list()
    for i in range(int(len_a)+int(len_b)):
        if i < int(len_a):
            a.append(input())
        else:
            b = input()
            out = ""
            for j in range(len(a)):
                if b == a[j]:
                    out += str(j+1) + " "
            if b not in a:
                out = "-1"
            print(out)