using System.Collections.Generic;
public MyDictionary(IEnumerable<string> words)
public bool IsInDict(string word)
public static void Main()
var myDictionary = new MyDictionary(new string[] {"cat", "car", "bar", "bat", "dog", "zebra", "doo" });
Debug.Assert(myDictionary.IsInDict("cat") == true);
Debug.Assert(myDictionary.IsInDict("don") == false);
Debug.Assert(myDictionary.IsInDict("caz") == false);
Debug.Assert(myDictionary.IsInDict("bat") == true);
Debug.Assert(myDictionary.IsInDict("zebra") == true);
Debug.Assert(myDictionary.IsInDict("ca*") == true);
Debug.Assert(myDictionary.IsInDict("c*t") == true);
Debug.Assert(myDictionary.IsInDict("*at") == true);
Debug.Assert(myDictionary.IsInDict("da*") == false);
Debug.Assert(myDictionary.IsInDict("*ag") == false);
Debug.Assert(myDictionary.IsInDict("do*") == true);
Console.WriteLine("Finished");
public static void Assert(bool a, [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
throw new Exception($"Test failed, line {sourceLineNumber}");