private static int Parse1(IEnumerable <string> input) { var foods = new List <Food>(); var allIngridients = new HashSet <string>(); var allAllergens = new HashSet <string>(); var ingredientToAllergen = new DefaultValueDictionary <string, HashSet <string> >(() => new HashSet <string>()); var allergensToIngredients = new DefaultValueDictionary <string, HashSet <string> >(() => new HashSet <string>()); foreach (var line in input) { var sp = line.Split("(contains"); var ingredients = sp[0].Trim().Split().ToList(); var allergens = sp[1][0..^ 1].Split(",").Select(x => x.Trim()).ToList();
public MemoryGame(string[] init) { this.init = init.Select(x => long.Parse(x)).ToArray(); this.mem = new DefaultValueDictionary <long, LastTwo>(() => new LastTwo()); }