#C121. Common Skills Finder
Common Skills Finder
Common Skills Finder
You are given information about employees and their respective skills. The input starts with an integer \(n\) that indicates the number of employees. Each of the following \(n\) lines contains an employee's ID and a list of skills separated by spaces.
Your task is to determine the common skills shared by every employee. If there are common skills, output them in lexicographical order (i.e. alphabetical order) separated by a space. Otherwise, output the string "No common skills".
Note: A skill is any non-empty string without spaces. Employee IDs can be ignored as they do not affect the computation of common skills.
The mathematical interpretation can be seen as computing the intersection \(\bigcap_{i=1}^{n} S_i\) where \(S_i\) is the set of skills of the \(i^{th}\) employee.
inputFormat
The first line of input is a single integer \(n\) representing the number of employees. The next \(n\) lines each contain an employee record. Each record is a space-separated list where the first entry is the employee ID and the remaining entries are the skills possessed by that employee.
For example:
3 1 java python 2 python javascript java 3 java python sql
outputFormat
If there is at least one common skill among all employees, print all common skills in lexicographical order separated by a single space. If there are no common skills, print "No common skills".
For the input example above, the output would be:
java python## sample
3
1 java python
2 python javascript java
3 java python sql
java python