22 lines
473 B
Python
22 lines
473 B
Python
with open(r'day7/input.txt', 'r') as input:
|
|
lines = input.read().split('\n')[:-1]
|
|
|
|
active = set([lines[0].index('S')])
|
|
|
|
split_cnt = 0
|
|
|
|
for line in lines[1:]:
|
|
active_buf = set()
|
|
for i in active:
|
|
if line[i] == '^':
|
|
if i > 0:
|
|
active_buf.add(i-1)
|
|
if i < len(line) -1:
|
|
active_buf.add(i+1)
|
|
split_cnt+=1
|
|
else:
|
|
active_buf.add(i)
|
|
active = active_buf
|
|
|
|
|
|
print(split_cnt)
|