Created
April 7, 2017 05:35
-
-
Save abhinavkorpal/81d731d2fd86d6f8fcee849702cf52ed to your computer and use it in GitHub Desktop.
DefaultDict Tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| d = defaultdict(list) | |
| n, m = list(map(int, raw_input().split())) | |
| for i in range(n): | |
| d[raw_input()].append(i + 1) | |
| for i in range(m): | |
| print(' '.join(map(str, d[raw_input()])) or -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment