hackerrank’taki 30 gunluk alistirmanin 8. gunu icin yazildi.
// Given n names and phone numbers, assemble a phone book that maps friends'
// names to their respective phone numbers. You will then be given an unknown
// number of names to query your phone book for. For each name queried, print the
// associated entry from your phone book on a new line in the form
// name=phoneNumber; if an entry for name is not found, print Not found instead.
// -------------------------------------------------
// constrains:
// 1<=n<=10^5
// 1<=queries<=10^5
// -------------------------------------------------
// Sample Input
//
// 3
// sam 99912222
// tom 11122222
// harry 12299933
// sam
// edward
// harry
// -------------------------------------------------
// Sample Output
//
// sam=99912222
// Not found
// harry=12299933
// dictionaries & maps
// yasin tasan
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
class collections
{
public static void Main()
{
string str_n = Console.ReadLine();
UInt32 n = Convert.ToUInt32(str_n);
if (n<=100000 && n>=1)
{
StringDictionary stringlist = new StringDictionary();
for (int i = 0; i < n; i++)
{
string name_number = Console.ReadLine();
string[] name_number_ = name_number.Split(' ');
stringlist.Add(name_number_[0], name_number_[1]);
}
for (int i = 0; i < n; i++)
{
string query = Console.ReadLine();
if (stringlist.ContainsKey(query))
{
string value = stringlist[query];
Console.WriteLine("{0}={1}", query, stringlist[query]);
}
else
{
Console.WriteLine("Not found");
}
}
}
}
}