Submit | All submissions | Best solutions | Back to list |
NAJFFT - Find File Type |
Day by day the file type increase. Now it very difficult to remember those file type and how software can access them. The type is usually inferred from the file extension. A file can access by different software. Such as PDF file can be open by Adobe Reader, Foxit Reader, PDF Reader etc.
Now we want create a table of file type with extention, file type and access software. You will be given a table of file type associations that associate a certain file extension with a certain file type and it’s access software. You will then be given a number of file names, and tasked to determine the correct file type and access software for each file. A file extension is defined as the part of the file name after the final period. If a file name has no periods, then it has no extension and the file type cannot be determined. If the file extension is not present in the table, then the file type cannot be determined. In such cases you will print "unknown" as the file type. If the file extension does appear in the table (case matters), then print the associated file type.
Input:
At firist there are two integers N and Q on a line. N is the number of file type associations, and Q is the number of file names.
Then N lines Follows, each containing a file extension, a file type and it’s access software name separated by a space.
Finally, Q lines, each containing the name of a file.
N and Q will be no greater than 1000 each. File extensions will consist only of alphanumeric characters, will have length at most 10, and will be distinct. File types and Access Software will have length at most 100, and will contain only alphanumeric characters and punctuation.
Finding File names will consist only of alphanumeric characters and periods and have length at most 200.
Output:
For each of the Q file names, print on a line the file type of the file and Access software sparte by a space. If there is no matching entry, print "unknown" (quotes for clarity).
Sample:
Input |
Output |
5 6 png image/png picasa index.html
|
Case 1: text/html firefox
|
Added by: | Najmuzzaman |
Date: | 2017-05-06 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL LISP clisp D ERL HASK JAVA OCAML PAS-GPC PAS-FPC PERL PHP PICO PIKE PYTHON PYPY PYTHON3 RUBY |