22 lines
490 B
Python
22 lines
490 B
Python
from pathlib import Path
|
|
|
|
FILE = "input.txt"
|
|
|
|
def main():
|
|
raw_lines = Path(FILE).read_text().splitlines()
|
|
beams = {raw_lines[0].index('S')}
|
|
splits = 0
|
|
for line in raw_lines[1:]:
|
|
for i, c in enumerate(line):
|
|
if c == '^':
|
|
if i in beams:
|
|
splits += 1
|
|
beams.remove(i)
|
|
beams.add(i-1)
|
|
beams.add(i+1)
|
|
return splits
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(main())
|