Building a Palette From Custom Hex Colors
A Marlow & Finch client's brand book lists their approved colours as hex codes, and nothing outside that list may appear in a chart. The studio therefore builds the palette from the exact codes rather than sampling a ready-made ramp. Before the charts are laid out, the build script reports how many colours the brand actually supplied, because a chart with more categories than colours has to be redesigned rather than fudged.
Task: Print how many colours the brand list contains.
Input
One line holding hex colour codes separated by single spaces, between 1 and 100 of them. Each code starts with # and contains no spaces.
Output
One line holding a whole number: how many colours were listed.
Example:
Input:
#FF0000 #00FF00 #0000FF
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