Problem:
Search III

Your task is to write a program of a simple dictionary which implements the following instructions:

insert str: insert a string str in to the dictionary

find str: if the distionary contains str, then print 'yes', otherwise print 'no'

Input

In the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.

Output

Print yes or no for each find instruction in a line.

Constraints

A string consists of 'A', 'C', 'G', or 'T'

1 ≤ length of a string ≤ 12

n ≤ 1000000

Sample Input 1

5
insert A
insert T
insert C
find G
find A

Sample Output 1

no
yes

Sample Input 2

13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T

Sample Output 2

yes
no
no
yes
yes
yes

Notes

Template in C

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string n_r = Console.ReadLine();
            int n = int.Parse(n_r);
            //string[] Lib = new string[n];
            Dictionary<string, string> Lib = new Dictionary<string, string>();
            string[] res = new string[n];
            int libCount = 0;
            for (int i = 0; i < n; i++)
            {
                string str_r = Console.ReadLine();
                string[] str = str_r.Split();
                switch (str[0])
                {
                    case "insert":
                        Lib[str[1]] = str[1];
                        libCount++;
                        break;
                    case "find":
                        if (Lib.ContainsKey(str[1]))
                            res[i] = "yes";
                        else
                            res[i] = "no";
                        break;
                    default:
                        break;

                }
            }
            for (int iii = 0; iii < n; iii++)
            {
                switch (res[iii])
                {
                    case "yes":
                    case "no":
                        Console.WriteLine(res[iii]);
                        break;
                    default:
                        break;
                }

            }
            Console.ReadLine();
            //    string n_r = Console.ReadLine();
            //    string S_r = Console.ReadLine();
            //    string q_r = Console.ReadLine();
            //    string T_r = Console.ReadLine();

            //    int n = int.Parse(n_r);
            //    string[] sS = S_r.Split();
            //    int[] S = new int[n];
            //    for (int i1 = 0; i1 < n; i1++)
            //    {
            //        S[i1] = int.Parse(sS[i1]);

            //    }
            //    int q = int.Parse(q_r);
            //    string[] sT = T_r.Split();
            //    int[] T = new int[n];
            //    for (int i2 = 0; i2 < q; i2++)
            //    {
            //        T[i2] = int.Parse(sT[i2]);

            //    }

            //    int Count = 0;

            //    int    left = 0;
            //    int    right = n;
            //    int mid;
            //    int key;
            //    for (int i = 0; i < q; i++)
            //    {
            //        left = 0;
            //        right = n;
            //        key = T[i];
            //        while (left < right)
            //        {
            //            mid = (left + right) / 2;
            //            if (S[mid] == key)
            //            {
            //                Count++;
            //                break;
            //            }
            //            else if (key < S[mid])
            //            {
            //                right = mid;
            //            }
            //            else
            //            {
            //                left = mid + 1;
            //            }


            //        }
            //        //for (int ii = 0; ii < n; ii++)
            //        //{
            //        //    if (S[ii] == T[i])
            //        //    {
            //        //        Count++;
            //        //        break;
            //        //    }

            //        //}
            //    }
            //    Console.WriteLine(Count);
            //    Console.ReadLine();
        }
    }
}