Ejemplo n.º 1
0
        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();
Ejemplo n.º 2
0
 public MemoryGame(string[] init)
 {
     this.init = init.Select(x => long.Parse(x)).ToArray();
     this.mem  = new DefaultValueDictionary <long, LastTwo>(() => new LastTwo());
 }