@@ -0,0 +1,1937 @@
+import java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Scanner;%0A%0A/**%0A * Auto-generated code below aims at helping you parse%0A * the standard input according to the problem statement.%0A **/%0Aclass Solution %7B%0A%0A    private final Map%3CString, String%3E associationMap;%0A%0A    public Solution() %7B%0A        associationMap = new HashMap%3C%3E();%0A    %7D%0A%0A    public void add(String ext, String mime) %7B%0A        associationMap.put(ext.toLowerCase(), mime);%0A    %7D%0A%0A    public String analyse(String str) %7B%0A        String toReturn = %22UNKNOWN%22;%0A        if (str.lastIndexOf(%22.%22) == -1) %7B%0A            return toReturn;%0A        %7D%0A        str = str.toLowerCase();%0A        String tmp = associationMap.get(str.substring(str.lastIndexOf(%22.%22) + 1));%0A        return tmp == null ? toReturn : tmp;%0A    %7D%0A%0A    public static void main(String args%5B%5D) %7B%0A        Scanner in = new Scanner(System.in);%0A        int N = in.nextInt(); // Number of elements which make up the association table.%0A        int Q = in.nextInt(); // Number Q of file names to be analyzed.%0A%0A        Solution s = new Solution();%0A%0A        // Fol all extension, add the mime type in hasmap%0A        for (int i = 0; i %3C N; i++) %7B%0A            String EXT = in.next(); // file extension%0A            String MT = in.next(); // MIME type.%0A            s.add(EXT, MT);%0A        %7D%0A        in.nextLine();%0A        StringBuilder sb = new StringBuilder(50);%0A        // Show all file/mime-type%0A        System.err.println(s.associationMap);%0A%0A        // Game loop%0A        for (int i = 0; i %3C Q; i++) %7B%0A            String FNAME = in.nextLine(); // One file name per line.%0A            System.err.println(%22FNAME %22 + FNAME + %22 = %22 + s.analyse(FNAME));%0A            sb.append(s.analyse(FNAME));%0A            sb.append(%22%5Cn%22);%0A        %7D%0A%0A        // For each of the Q filenames, display on a line the corresponding MIME type. If there is no corresponding type, then display UNKNOWN.%0A        System.out.println(sb.toString());%0A    %7D%0A%7D

add mime-type