Created
October 17, 2016 12:45
-
-
Save sjparkinson/01a59c332ee09a417b7917ad28313fa9 to your computer and use it in GitHub Desktop.
This file contains 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
import sys | |
import math | |
# Auto-generated code below aims at helping you parse | |
# the standard input according to the problem statement. | |
mime_types = {} | |
file_names = [] | |
count_mime_types = int(input()) # Number of elements which make up the association table. | |
count_file_names = int(input()) # Number of file names to be analyzed. | |
for i in range(count_mime_types): | |
extension, value = input().split() | |
mime_types[extension.lower()] = value | |
for i in range(count_file_names): | |
file_name = input() | |
# There may not be an extension... | |
if "." in file_name: | |
# Second value is the extension. | |
file_extension = file_name.rsplit(".", 1)[1].lower() | |
# Lookup with a default value. | |
print(mime_types.get(file_extension, "UNKNOWN")) | |
else: | |
print("UNKNOWN") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment