Coloring Points by Category
Meridian Insight is plotting staff survey results for a client: every employee is one dot, and the dots are tinted by which department the person works in, so a reader can tell the groups apart without a separate chart each. Before the picture is worth printing, the client needs to know how many tints it will actually need — too many and the palette stops being readable at all.
Task: Print how many different departments appear in the list. Department names are compared exactly as written: two spellings that differ only in capitalisation are two different departments.
Input
The first line holds an integer n, the number of employees. Each of the next n lines holds three fields separated by single spaces: two numbers, then the department name. The name is a single word with no spaces in it. n is at least 1.
Output
One line holding a whole number: the count of different departments.
Example:
Input:
3
1 2 Eng
3 4 Sales
5 6 Eng
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in