Input to your software module will be a directory of names and extensions, one per line, followed by lines containing arbitrary numeric strings dialed by people calling XYZ Corporation. Each directory entry consists of a first name, one space, a last name, one space, and a 4-digit phone extension.
Names can contain any combination of up to twenty lower and upper case letters.
No input line will exceed 80 characters. For each dialed number, the program is to output, on one line starting in the first column, the list of extensions to which the number could be referring. Multiple extensions that match a dialed number are to be separated from each other by single spaces. The dialed number must match the characters in the name exactly. If the input fails to match any names or extensions, output 0.