示例#1
0
        public string CheckInputToGetAnswerPart1()
        {
            var ruleReader = new RuleReader();

            ruleReader.MakeRegexFromRules(Rules, 0);
            return(Messages.Count(i => ruleReader.CheckStringAgainstRules(i)).ToString());
        }
示例#2
0
        public string CheckInputToGetAnswerPart2()
        {
            var newRules = Rules.Select(m =>
                                        m.Replace("8: 42", "8: 42 | 42 8").Replace("11: 42 31", "11: 42 31 | 42 11 31")).ToList();
            var ruleReader = new RuleReader();

            ruleReader.MakeRegexFromRules(newRules, Messages.Max(m => m.Length));
            return(Messages.Count(i => ruleReader.CheckStringAgainstRules(i)).ToString());
        }