day 19, easier than previous ones
This commit is contained in:
parent
6e465d60aa
commit
5700e7d1e1
|
@ -0,0 +1,6 @@
|
||||||
|
import sys
|
||||||
|
from functools import cache
|
||||||
|
f = cache(lambda s: 1 if len(s)==0 else sum(f(s[len(r):]) for r in R if s.startswith(r)))
|
||||||
|
R, I = sys.stdin.read().strip().split("\n\n") ; R = R.split(", ")
|
||||||
|
print(sum(f(i)>0 for i in I.split("\n")))
|
||||||
|
print(sum(f(i) for i in I.split("\n")))
|
Loading…
Reference in New Issue