Get a job

A job placement service at your university handles summer stages of
students in commercial companies. This year, there is a set of students
requesting a job, and several companies offering exactly one job. After
evaluating all the curricula, the job placement service has a list of
the companies that are willing to hire each student. The director of
this service wishes to know the maximum number of jobs that can be
filled.

Input

Input consists of several cases. Every case begins with the number of
students n, followed by n lines with the offers for each student, with
exactly the format shown in the sample input. Some students can receive
offers from every company, but the average number of offers per student
is “small”. All student names and company names are different
alphanumeric strings. Overall, there are at most n company names. Assume
1 ≤ n ≤ 1000.

Output

For each case, print the maximum number of jobs that can be filled.

Problem information

Author: Jordi Petit

Generation: 2026-01-25T10:23:30.196Z

© Jutge.org, 2006–2026.
https://jutge.org
