Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Solution
- {
- static void Main(String[] args)
- {
- string[] inputs;
- string[] fName;
- int N = int.Parse(Console.ReadLine()); // Number of elements which make up the association table.
- int Q = int.Parse(Console.ReadLine()); // Number Q of file names to be analyzed.
- string[,] dataBase = new string [N,2];
- int i;
- for (i = 0; i < N; i++)
- {
- inputs = Console.ReadLine().Split(' ');
- dataBase [i,0]= inputs[0]; // file extension
- dataBase [i,1]= inputs[1]; // MIME type.
- }
- for (i = 0; i < Q; i++)
- {
- bool flag = true;
- fName = Console.ReadLine().Split('.');
- string fileType = fName[fName.Length-1];
- for (int n = 0; n < N; n++) {
- if (fName.Length==1) break;
- int r = String.Compare (fileType, dataBase [n,0], true);
- if (r == 0) {
- Console.WriteLine (dataBase [n,1]);
- flag = false;
- break;
- }
- }
- if (flag == true) Console.WriteLine ("UNKNOWN");
- }
- Console.Error.WriteLine (i);
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- //Console.WriteLine("UNKNOWN"); // For each of the Q filenames, display on a line the corresponding MIME type. If there is no corresponding type, then display UNKNOWN.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement