1
0
Fork 0
adventofcode/2015/3/elf.py

16 lines
249 B
Python
Executable File

#!/usr/bin/env python3
import sys
pos = [(0,0)]
x, y = 0,0
for c in sys.stdin.readline().strip():
if c == '^':
y = y + 1
elif c == 'v':
y = y - 1
elif c == '<':
x = x - 1
elif c == '>':
x = x + 1
pos.append((x, y))
print(len(set(pos)))