summaryrefslogtreecommitdiff
path: root/6_2022.py
diff options
context:
space:
mode:
Diffstat (limited to '6_2022.py')
-rw-r--r--6_2022.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/6_2022.py b/6_2022.py
new file mode 100644
index 0000000..0362b1f
--- /dev/null
+++ b/6_2022.py
@@ -0,0 +1,15 @@
+import sys
+
+infile = sys.argv[1] if len(sys.argv) > 1 else "6_2022.txt"
+data = open(infile).read()
+lines = [x for x in data.split("\n")]
+
+p1 = False
+p2 = False
+for i in range(len(data)):
+ if (not p1) and i - 3 >= 0 and len(set([data[i - j] for j in range(4)])) == 4:
+ print(i + 1)
+ p1 = True
+ if (not p2) and i - 13 >= 0 and len(set([data[i - j] for j in range(14)])) == 14:
+ print(i + 1)
+ p2 = True