Posts

Showing posts with the label default dict

Challenge - #34 - Default Dict Tutorial

 from collections import defaultdict d = defaultdict(list) n,m = list(map(int, input().split())) for i in range(n):     d[input()].append(i+1) for i in range(m):     print(' '.join(map(str, d[input()])) or -1)