Under construction

Still being built. Things may change

Orphan Backups

Time limit1sMemory limit1024 MB

Summary
Given a list of backup image names and a list of backup file names, print the files with no index entry and the index entries with no files, each sorted.
Level

Medium4 of 10

Topics
Hash map, String, Sorting
Solved
No attempts yet

Problem

GigantoCorp has removed all tape drives from its data center and now does all of its backups to disk storage. However, it appears to use more disk space than its backup software reports. The company suspects that some files on the backup storage are missing from the backup software index. Write a program that checks whether the backup storage has "orphan" files that are not in the index, or "orphan" index entries that have no matching files on the backup storage.

Input

The input has two blocks.

The first block is a list of backup image names, one per line. Each name is 1 to 3232 printable ASCII characters with no spaces. There may be up to 100 000100\,000 images. Names are unique and may appear in any order.

The block ends with an empty line.

The second block is a list of backup file names, one per line, left justified. Each file name has the format

imageName_integer_type

where imageName is a backup image name as described above, integer is an integer from 00 to 2 000 000 0002\,000\,000\,000 giving the time in seconds since January 1, 1970 at 00:00 GMT (the UNIX epoch), and type is a string of 1 to 6 uppercase letters. There may be up to 300 000300\,000 file names. File names are unique and may appear in any order.

The second block ends at the end of the file.

Output

First, print each file that has no index entry, one per line, as the character "F", a single space, and the file name. After all orphan files, print each orphan index entry, one per line, as the character "I", a single space, and the image name. Print each list in ASCII lexicographic order.

If every file has an index entry and every index entry has at least one file, print only the line "No mismatches.".

Examples1

  1. Example 1

    Input
    payroll.xls
    projects.doc
    employees.dat
    products.txt
    
    payroll.xls_1539199053_INCR
    employees.dat_1539199053_INCR
    payroll.xls_1539112653_INCR
    employees.dat_1539112653_INCR
    payroll.xls_1539026253_FULL
    employees.dat_1539026253_FULL
    customers.dat_1539026253_FULL
    
    Expected output
    F customers.dat_1539026253_FULL
    I products.txt
    I projects.doc