Problems > Unique Word Count

Unique Word Count

Difficulty: 900 2000 ms 128 MB

strings

How many distinct words does the line contain?

Input: one line with words separated by single spaces.

Output: the number of distinct words.

Constraints:

  • 1 to 200 words of lowercase letters

Sample Tests

Input 1
the cat and the hat
Output 1
4
Input 2
a a a
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.