Example #1
0
        public string PartTwo(string[] lines)
        {
            var chunks    = lines.ChunkBy(string.IsNullOrEmpty, true).Select(Enumerable.ToArray).ToArray();
            var automaton = new NondeterministicFiniteStateAutomaton(chunks[0], withLoopRules: true, longestInputSize: chunks[1].Max(s => s.Length));

            return(chunks[1].Count(automaton.Match).ToString());
        }
Example #2
0
        public string PartOne(string[] lines)
        {
            var chunks    = lines.ChunkBy(string.IsNullOrEmpty, true).Select(Enumerable.ToArray).ToArray();
            var automaton = new NondeterministicFiniteStateAutomaton(chunks[0]);

            return(chunks[1].Count(automaton.Match).ToString());
        }