Choosing Custom Colors for Each Slice
Calder & Voss paints each product line in the colour the client's brand guide assigns to it, rather than letting the drawing tool choose. One colour in that guide carries meaning: red marks the line being discontinued. The caption has to name that line in words, because a reader who is colour blind cannot pick a red wedge out of a circle at all — which is the standing argument against letting colour carry meaning on its own.
Task: Print the name of the category whose colour is red. Match the colour name exactly as written, in lower case, so a category painted Red is a different colour and does not count. If more than one category is painted red, print whichever of them appears earliest in the list.
Input
The first line holds an integer n, the number of categories. Each of the next n lines holds three fields separated by single spaces: the category name, its value, and its colour name. Names and colours are single words with no spaces. At least one category is painted red.
Output
One line holding the category name, spelled exactly as it appeared.
Example:
Input:
3
A 50 red
B 30 blue
C 20 green
Output:
A
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