Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MimePair:
- def __init__(self, ext, mt):
- self.ext = ext
- self.mt = mt
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- n = int(raw_input()) # Number of elements which make up the association table.
- q = int(raw_input()) # Number Q of file names to be analyzed.
- mimeList = []
- for i in xrange(n):
- # ext: file extension
- # mt: MIME type.
- ext, mt = raw_input().split()
- mimeList.append(MimePair(ext.lower(), mt))
- for i in xrange(q):
- fname = raw_input().split('.') # One file name per line.
- searchFlag = 0
- match = [x for x in mimeList if x.ext == fname[-1].lower()]
- if len(match) > 0 and len(fname) > 1:
- print match[0].mt
- else:
- print 'UNKNOWN'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement