Problem:
Score : 300 points

Problem Statement

You drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.

How many kinds of items did you get?

Constraints

1 \leq N \leq 2\times 10^5

S_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print the number of kinds of items you got.

Sample Input 1

3
apple
orange
apple

Sample Output 1

2

You got two kinds of items: apple and orange.

Sample Input 2

5
grape
grape
grape
grape
grape

Sample Output 2

1

Sample Input 3

4
aaaa
a
aaa
aa

Sample Output 3

4

Solution in C (GCC 9.2.1) (judge verdict: Accepted)

#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <ctype.h>  /*文字操作*/

#define BUFSIZE 256   /*読み取れる単語の最大文字数*/
#define NOT_FOUND 0   /*単語が二分探索木に存在していない状態*/
#define FOUND     1   /*単語が二分探索木に存在する状態*/
#define YES       0   /*走査を続ける状態*/
#define NO        1   /*走査をやめる状態*/

int flag      = NOT_FOUND; /*単語が存在するか否かを示す変数*/
long Word_sum = 0;         /*単語の総数*/

/*二分探索木を作る構造体*/
struct Word_Tree{
  char word[BUFSIZE];       /*単語を格納する配列*/
  struct Word_Tree *left;   /*左の子を指すポインタ*/
  struct Word_Tree *right;  /*右の子を指すポインタ*/
};

struct Word_Tree *root = NULL;  /*二分探索木の根*/

/*単語の二分探索木を作成する関数*/
struct Word_Tree MakeTree(char *buf, int *count);

/*二分探索木で使用した領域を解放する関数*/
int Free(struct Word_Tree *pointer);

int main(void)
{
  int n;
  int count = 0;
    char buf[BUFSIZE]  = {}; 	/*読み取った単語*/
    struct Word_Tree *print;  /*出力時に用いるポインタ*/

    /*読み込み部*/
    scanf(" %d", &n);

    /*処理部*/
    /*二分探索木の作成*/
    for (size_t i = 0; i < n; i++) {
      scanf(" %s", &buf);
      MakeTree(buf,&count);
    }
    printf("%d\n", count);

    Free(root);
    return 0;
}

/*単語の二分探索木を作成する関数*/
struct Word_Tree MakeTree(char *buf/*読み込んだ文字*/,int *count)
{
  struct Word_Tree *pointer;  /*作業用ポインタ*/
  struct Word_Tree *parent;   /*pointerの親を指すポインタ*/
	int n = strlen(buf);

          /*二分探索木が作成されてないとき*/
          if(root == NULL){
            root = (struct Word_Tree *)malloc( sizeof(struct Word_Tree));
            strcpy(root->word,buf);
            root->left  = NULL;
            root->right = NULL;
            *count = *count +1;
          }
          /*探索木を更新するとき*/
          else{
            pointer = root;
            parent  = pointer;
            while(1){
              if(pointer == NULL){
                pointer = (struct Word_Tree *)malloc( sizeof(struct Word_Tree));
                if (strcasecmp(parent->word, buf) > 0 ) {
                  parent->left  = pointer;
                }
                else{
                  parent->right = pointer;
                }
                strcpy(pointer->word,buf);
                pointer->left  = NULL;
                pointer->right = NULL;
                *count = *count +1;
                break;
              }
              if (strcasecmp(pointer->word, buf) == 0) {
                break;
              }else if(strcasecmp(pointer->word, buf) > 0){
                parent  = pointer;
                pointer = pointer->left;
              }else{
                parent  = pointer;
                pointer = pointer->right;
              }
            }
          }
}


/*二分探索木で使用した領域を解放する関数*/
int Free(struct Word_Tree *pointer)
{
  if (pointer == NULL) {return 0;}
  Free(pointer->left);
  Free(pointer->right);
  free(pointer);
}