Coloring Points by a Third Column (hue)
Fernbrook Analytics colours the dots on a client panel by which product line each record came from, so a reader can tell three overlapping clouds apart. Colour has a hard limit: past about eight shades nobody can match a dot to a legend entry any more. Before the panel is generated the tool reports how many different product lines are actually present, so an unusable chart is caught early.
Task: Print how many different product lines appear.
Input
The first line holds one integer n, the number of records. Each of the next n lines holds two measurements and a product line label, separated by single spaces. Labels contain no spaces and are compared exactly as written, so two labels differing only in capitalisation count as two.
Output
One line holding a single whole number: how many different labels appear across all the records. A label used by ten records still counts once.
Example:
Input:
3
1 2 A
3 4 B
5 6 A
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