In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of April 7th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #05 exercise sheet]
In this problem you should submit a complete program with the main function, reading with functions such as scanf and printing with functions such as printf.
In the sun-scorched kingdom of Dorne, words are as sharp as blades, and Oberyn Martell, the Red Viper, is known for both. A master of combat and conversation, Oberyn values those who can separate truth from noise.
One evening, as the sun sets over Sunspear, Oberyn issues you a challenge: "In battle, every move must be precise - no wasted steps. In words, only those that are unique hold power. Show me that you can count the words that matter, and perhaps I will trust you with secrets even the sands cannot bury."
Given a set of words, your task is to count how many unique words exist, that is, repeated words should only be counted once.
The first line of input contain an integer N, representing the number of words that follow.
Each of the next N lines contain a word W formed only by lowercase letters.
The output should be a single line containing an integer: the number of different words that appear on the input, as explained in the problem description
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ N ≤ 100 | Number of words | |
1 ≤ |W| < 100 | Length of the words |
Example Input | Example Output |
12 stark targaryen lannister baratheon baratheon martell lannister targaryen stark targaryen stark baratheon |
5 |
Explanation of the Example Input
There are 5 different words: "stark", "targaryen", "lannister", "baratheon" and "martell".