In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of December 7th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #08 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP077] The Art of Storytelling

Oberyn Martell, known as the Red Viper of Dorne, is in love with the art of storytelling and the choice of words used in Westeroos' romantic poems and texts. To analyze the richness of vocabulary in a text, he wants to determine the number of unique words present.

The Problem

Write a function count_words(text) that given a string text, returns the number of unique words in the text. A "word" is defined as any sequence of alphabetic characters separated by non-alphabetic characters (which in this problem may only be whitespaces). The function should be case-insensitive, meaning "Winter" and "winter" are considered the same word.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ |text| ≤ 200       length of text

You can also be assured that the text will only be made by whitespace and upper and lowercase letters.


Example Function Calls Example Output
print(count_words("winter is coming"))
print(count_words("to be or not to be that is the question"))
print(count_words("Can you can a Can as a canner can can a Can"))
3
8
5

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto