aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2019/04/.gitignore1
-rw-r--r--2019/04/Makefile1
-rw-r--r--2019/04/puzzles.sh8
3 files changed, 10 insertions, 0 deletions
diff --git a/2019/04/.gitignore b/2019/04/.gitignore
new file mode 100644
index 0000000..dd596dd
--- /dev/null
+++ b/2019/04/.gitignore
@@ -0,0 +1 @@
+puzzle-[12].sh \ No newline at end of file
diff --git a/2019/04/Makefile b/2019/04/Makefile
new file mode 100644
index 0000000..2e36725
--- /dev/null
+++ b/2019/04/Makefile
@@ -0,0 +1 @@
+include ../../Makefiles/sh.mk \ No newline at end of file
diff --git a/2019/04/puzzles.sh b/2019/04/puzzles.sh
new file mode 100644
index 0000000..b3bcfed
--- /dev/null
+++ b/2019/04/puzzles.sh
@@ -0,0 +1,8 @@
+IFS=- read lo hi <input
+seq $lo $hi |
+ grep -E '([0-9])\1' |
+ grep -E '^0*1*2*3*4*5*6*7*8*9*$' |
+ # START PART 2
+ grep -E '^(0{2}1*2*3*4*5*6*7*8*9*|0*1{2}2*3*4*5*6*7*8*9*|0*1*2{2}3*4*5*6*7*8*9*|0*1*2*3{2}4*5*6*7*8*9*|0*1*2*3*4{2}5*6*7*8*9*|0*1*2*3*4*5{2}6*7*8*9*|0*1*2*3*4*5*6{2}7*8*9*|0*1*2*3*4*5*6*7{2}8*9*|0*1*2*3*4*5*6*7*8{2}9*|0*1*2*3*4*5*6*7*8*9{2})$' |
+ # END PART 2
+ wc -l \ No newline at end of file