2015: d01: ex1: add solution
This commit is contained in:
parent
086fef2122
commit
380b527017
1 changed files with 18 additions and 0 deletions
18
2015/d01/ex1/ex1.py
Executable file
18
2015/d01/ex1/ex1.py
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import collections
|
||||
import sys
|
||||
|
||||
|
||||
def solve(input: str) -> int:
|
||||
directions = collections.Counter(input.strip())
|
||||
return directions["("] - directions[")"]
|
||||
|
||||
|
||||
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