#C12399. Count Unique Words
Count Unique Words
Count Unique Words
Your task is to write a program that reads a string from standard input and outputs the number of unique words contained in it. A word is defined as a maximal substring of non-space characters. The comparison of words should be case-insensitive, meaning that words differing only in letter case are considered the same.
For example:
- The input
This is a test This test is
should return4
because there are 4 unique words: "this", "is", "a", "test". - The input
one one ONE one
should return1
.
Note: Ensure that your solution reads input from standard input (stdin) and writes the result to standard output (stdout).
inputFormat
The input consists of a single line containing a string s. The string may include spaces, and its length can be zero.
outputFormat
Output a single integer representing the number of unique words in the given string. Words are compared in a case-insensitive manner.
## sampleThis is a test This test is
4