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: Time Limit Exceeded)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
  int N, len_sorted;
  char S[2 * 100000][11];
  char sorted[2 * 100000][11];

  scanf("%d", &N);
  len_sorted = 0;
  for (int i = 0; i < N; i++)
  {
    // printf("------------------\n");

    char input_tmp[11];
    scanf("%s", input_tmp);

    int max = len_sorted - 1;
    int min = 0;
    int mid = -1;

    while (1)
    {
      mid = (max + min) / 2;

      if (len_sorted == 0)
      {
        strcpy(sorted[0], input_tmp);
        len_sorted++;
        break;
      }

      int cmp = strcmp(input_tmp, sorted[mid]);
      // printf("%d %d %d  %d => ", min, mid, max, cmp);
      if (cmp == 0)
      {
        break;
      }
      else if (cmp > 0)
      {
        min = mid + 1;
      }
      else
      {
        max = mid - 1;
      }
      // printf("%d %d %d\n", min, mid, max);

      if (max < min)
      {
        int insert = min;

        // printf("insert: %d\n", insert);

        for (int j = len_sorted; j >= insert && j != 0; j--)
        {
          strcpy(sorted[j], sorted[j - 1]);
        }
        strcpy(sorted[insert], input_tmp);
        len_sorted++;

        break;
      }
    }

    /*
    for (int j = 0; j < len_sorted; j++)
    {
      printf("%s, ", sorted[j]);
    }
    printf("\n");
    */
  }

  printf("%d", len_sorted);

  return 0;
}