Custom Color Palettes
Tidewater Foods keeps a house colour scheme, and the chart builder assigns colours from it one per category. Schemes run out: past a certain number of categories the colours start repeating or become impossible to tell apart. Before a chart is built the tool reports how many bars it would draw, and anything over about eight gets sent back for a redesign.
Task: Print how many bars the chart would draw.
Input
The first line holds one integer n, the number of records. Each of the next n lines holds a category name and one value, separated by a single space. Category names contain no spaces, and a category may appear on many lines. Names are compared exactly as written, so a and A are two different categories.
Output
One line holding a single whole number: how many different category names appear. One bar is drawn per category, however many records that category has.
Example:
Input:
3
A 10
B 20
C 15
Output:
3
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