A repro for all my Advent of ode tasks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
601 B

import os
import sys
file = open('input.txt', 'r')
input = file.read()
open = "("
close = ")"
open_count = input.count(open)
close_count = input.count(close)
print("Open count: " + str(open_count))
print("Close count: " + str(close_count))
floor = open_count - close_count
print("Santa is on floor: " + str(floor))
floor = 0
count = 0;
for char in input:
if char == open:
floor = floor + 1
if char == close:
floor = floor - 1
count = count + 1
if floor < 0:
break;
print("Santa visits the basement first at position: " + str(count))