#C4251. Find Employees by Project
Find Employees by Project
Find Employees by Project
Given an integer ( n ) denoting the number of employees, followed by ( n ) lines each containing an employee record, and a project name, your task is to identify the employees who have worked on the specified project. Each record is in the format Name: Project1, Project2, ...
with a colon and projects separated by commas. Return the names of the matching employees in alphabetical order. If no employee has worked on the specified project, output None
.
inputFormat
The input is given via standard input (stdin) and is formatted as follows:
- An integer ( n ) representing the number of employee records.
- ( n ) lines, each containing an employee record in the format: "Name: Project1, Project2, ...".
- A single line containing the project name to query.
For example:
3 Alice: ProjectA, ProjectB, ProjectC Bob: ProjectA, ProjectD Charlie: ProjectB, ProjectE ProjectA
outputFormat
Output the names of the employees who have worked on the given project in alphabetical order, separated by a single space. If no employee is found, output None
. The output should be written to standard output (stdout).
For example, for the input above, the output would be:
Alice Bob## sample
3
Alice: ProjectA, ProjectB, ProjectC
Bob: ProjectA, ProjectD
Charlie: ProjectB, ProjectE
ProjectA
Alice Bob