using System.Collections.Generic;
public class ScoreLookup {
private Dictionary<string, int> scores = new Dictionary<string, int>();
public void AddScore(string name, int score) {
public int LookupScore(string name) {
string[] nameArray = name.Split(' ');
if (scores.TryGetValue(nameArray[0], out value))
Console.WriteLine(name + " " + value);
if (scores.TryGetValue(nameArray[1], out value))
Console.WriteLine(name + " " + value);
Console.WriteLine("Key = \"tif\" is not found.");
public static void Main()
ScoreLookup lookup = new ScoreLookup();
lookup.AddScore("John Chan", 55);
lookup.AddScore("Henry Wong", 0);
lookup.AddScore("Mary Lee", 60);
lookup.AddScore("Hillary Clinton", 99);
lookup.AddScore("Pikachu", 100);
Console.WriteLine(lookup.LookupScore("John"));
Console.WriteLine(lookup.LookupScore("Mary Lee"));
Console.WriteLine(lookup.LookupScore("Pikachu"));
Console.WriteLine(lookup.LookupScore("Wong"));
Console.WriteLine(lookup.LookupScore("Hillary"));