summaryrefslogtreecommitdiffstats
path: root/6.py
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2022-12-07 12:57:36 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2022-12-07 12:57:36 +0000
commitd9a97e9bf28cf91f1a7e57f1298b7c742e25ed56 (patch)
tree999464f801480565733c5223b020b2d762140b00 /6.py
downloadaoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.tar.gz
aoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.tar.xz
aoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.zip
days 1-7
Diffstat (limited to '6.py')
-rw-r--r--6.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/6.py b/6.py
new file mode 100644
index 0000000..5c3a3d0
--- /dev/null
+++ b/6.py
@@ -0,0 +1,8 @@
+with open('6.in') as f:
+ inp = f.read().rstrip()
+def solve(inp, n):
+ for i in range(n, len(inp)):
+ if len(set(inp[i-n:i])) == n:
+ return i
+print(solve(inp, 4))
+print(solve(inp, 14))