#C1520. Unique Employees in Projects

    ID: 44735 Type: Default 1000ms 256MiB

Unique Employees in Projects

Unique Employees in Projects

You are given multiple datasets that describe projects and the employees assigned to them. Each dataset begins with an integer \(n\) indicating the number of projects, followed by \(n\) lines. Each project is described by a line of the form:

project_name:employee1,employee2,...,employeeK.

Your task is to compute the number of unique employees involved in each dataset. The input terminates with a line containing a single 0.

Note: The colon (:) separates the project name and its employees, and the employee names are comma separated. The employee list ends with a period.

inputFormat

The input is given via standard input (stdin) and consists of multiple datasets. Each dataset begins with a line containing an integer (n) ((n \geq 1)), which represents the number of projects in that dataset. The following (n) lines each contain details of a project in the format: project_name:employee1,employee2,...,employeeK.. A line containing a single 0 marks the end of input.

outputFormat

For each dataset, output a single line on standard output (stdout) containing the total number of unique employees across all projects in that dataset.## sample

2
project1:alice,bob,charlie.
project2:bob,dave,eve.
3
projectA:frank,grace,heidi.
projectB:heidi,ivan.
projectC:frank,judy.
3
design:alice,bob.
development:carol,dave.
testing:eve,alice.
0
5

5 5

</p>