I do not know what the problem is that you have, but I have an idea. One of the questions may be the word you provide is not in the dictionary. This may result in KeyNotFoundException. A simple fix would look something like this:
if(Dict.ContainsKey(word)){
Console.WriteLine(Dict[word]);
} else {
Console.WriteLine(0);
}
, , , foreach(var item in Dict). . item KeyValuePair<string,int> Console.WriteLine(item);, , , . Console.WriteLine(item) Console.WriteLine(item.Key + " " +item.Value);