fix: Fixed Day 2 - part 2 not working yet
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
string input = File.ReadAllText("input.txt").ReplaceLineEndings("");
|
||||
int total = 0;
|
||||
|
||||
Regex valid = new Regex("mul\\((?<x>[0-9]+),(?<y>[0-9]+)\\)");
|
||||
Regex dontandDo = new Regex("(don\\'t\\(\\).*?do\\(\\))");
|
||||
Regex valid = new Regex(@"mul\((?<x>[0-9]+),(?<y>[0-9]+)\)");
|
||||
Regex dontandDo = new Regex(@"(don\'t\(\).*?do\(\))");
|
||||
|
||||
input = dontandDo.Replace(input, "");
|
||||
int muls = valid.Count(input);
|
||||
|
||||
List<(int x, int y)> multiplies = new();
|
||||
|
||||
@@ -22,4 +23,4 @@ foreach ((int x, int y) in multiplies)
|
||||
total += x * y;
|
||||
}
|
||||
|
||||
Console.WriteLine(total);
|
||||
Console.WriteLine($"muls: {muls}");
|
||||
Reference in New Issue
Block a user