diff --git a/2015/d01/ex1/ex1.py b/2015/d01/ex1/ex1.py new file mode 100755 index 0000000..616d288 --- /dev/null +++ b/2015/d01/ex1/ex1.py @@ -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()