This commit is contained in:
DUEFON 2022-12-06 06:11:46 +01:00
parent c199c0ab05
commit ab1cc7feee
2 changed files with 7 additions and 6 deletions

12
sixx.py
View File

@ -1,11 +1,11 @@
#!/usr/bin/env python3
from useful import *
ls = lines(open(0))
def n(l):
def n(l, x):
for i, _ in enumerate(l):
if len(list(set(l[i:i+4]))) == 4:
return i+4
if len(list(set(l[i:i+x]))) == x:
return i+x
ic([n(l) for l in ls])
print(sum([n(l) for l in ls]))
ls = lines(open(0))
print(sum([n(l, 4) for l in ls]))
print(sum([n(l, 14) for l in ls]))

1
test6 Normal file
View File

@ -0,0 +1 @@
mjqjpqmgbljsphdztnvjfqwrcgsmlb