#C116. Count Distinct Gemstones
Count Distinct Gemstones
Count Distinct Gemstones
You are given a collection of gemstones. Your task is to count the number of distinct gemstone types in the collection.
The input consists of two lines. The first line contains a single integer \( n \) (the number of gemstones). The second line contains \( n \) space separated strings denoting the names of the gemstones. Your program should output a single integer: the number of distinct gemstone types present in the collection.
Note: When processing the input, you should read from stdin
and write the result to stdout
.
inputFormat
The input is given in two lines:
- The first line contains an integer \( n \) indicating the number of gemstones.
- The second line contains \( n \) space-separated strings, each representing a gemstone name.
Read the input from stdin
.
outputFormat
Output a single integer representing the count of distinct gemstone types found in the collection. Write the output to stdout
.
5
emerald ruby sapphire ruby emerald
3