#K48377. Count Unique Projects
Count Unique Projects
Count Unique Projects
You are given a list of employees, each accompanied by the projects they are working on. Your task is to determine the total number of unique projects from the provided list. Each employee entry is a space-separated string where the first token is the employee name and the subsequent tokens (if any) are the project identifiers. Note that if an employee has no projects listed, that entry contributes nothing to the count.
In mathematical terms, if the input is an integer (n) (the number of employees) followed by (n) strings, and each string is formatted as:
then you are required to compute the number of distinct projects present across all (n) lines.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) representing the number of employees. The following (n) lines each contain an employee record: the employee's name, followed by zero or more project names separated by spaces.
outputFormat
Output a single integer to standard output (stdout) representing the total number of unique projects.## sample
4
Alice project1 project2
Bob project2 project3
Charlie project3 project4
David project1 project5
5