Пример #1
0
        static void Main(string[] args)
        {
            var    input  = ParseInput.Parse("Day7input.txt");
            string day7p1 = Day7.Day7Part1.Run(input);

            Console.WriteLine("Hello World!");
        }
Пример #2
0
        public static (string Bag, Dictionary <string, int> Contents) Parse(string line)
        {
            var words = ParseInput.Words(line).ToList();

            var bag      = $"{words[0]} {words[1]}";
            var contents = new Dictionary <string, int>();

            for (var i = 4; i < words.Count; i += 4)
            {
                if (words[i] != "no")
                {
                    contents.Add($"{words[i + 1]} {words[i + 2]}", int.Parse(words[i]));
                }
            }

            return(bag, contents);
        }