public Day4(string path) : base(4) { passports = new Iter <Passport>(); FileParser parser = new FileParser(path); StringBuilder builder = new StringBuilder(); foreach (var line in parser.Lines) { if (line.Length == 0) { if (builder.Length > 1) { passports.Add(Passport.FromString(builder.ToString())); } builder = new StringBuilder(); } builder.Append(line.Trim() + " "); } if (builder.Length > 1) { passports.Add(Passport.FromString(builder.ToString())); } }
public Day2(string path) : base(2) { FileParser parser = new FileParser(path); input = new Iter <string[]>(); foreach (var res in parser.SplitLinesByRegex(regex)) { input.Add(res); } }