diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-12-12 10:15:04 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-12-12 10:15:04 +0000 |
commit | 7a02361e62b282a12f5d693858f7fb2e99a7f029 (patch) | |
tree | d8d042fcfc0730994e6e41fcd3653b4a68195965 | |
parent | 44877113c1b782f820464be7bc412751c63d7f1f (diff) | |
download | aoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.tar.gz aoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.tar.xz aoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.zip |
"oneline" the final loop
-rw-r--r-- | 12.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -29,9 +29,9 @@ for line in stdin: print(sum(matching(pattern, groups, len(pattern)) for pattern, groups in inp)) - -p2 = 0 -for pattern, groups in inp: - pattern = "?".join([pattern] * 5) - p2 += matching(pattern, groups * 5, len(pattern)) -print(p2) +print( + sum( + matching("?".join([pattern] * 5), groups * 5, len(pattern) * 5 + 4) + for pattern, groups in inp + ) +) |