2015: d08: ex1: add solution
This commit is contained in:
parent
72d37ffa5c
commit
0c458813d4
1 changed files with 19 additions and 0 deletions
19
2015/d08/ex1/ex1.py
Executable file
19
2015/d08/ex1/ex1.py
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import ast
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def solve(input: str) -> int:
|
||||||
|
strings = input.splitlines()
|
||||||
|
# It's too easy to use the built-in parser not to do it...
|
||||||
|
return sum(len(raw) - len(ast.literal_eval(raw)) for raw in strings)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
input = sys.stdin.read()
|
||||||
|
print(solve(input))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue