28 lines
492 B
Python
Executable File
28 lines
492 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
pos = [(0,0)]
|
|
ax, ay, bx, by, current = 0, 0, 0, 0, True
|
|
for c in sys.stdin.readline().strip():
|
|
if current:
|
|
if c == '^':
|
|
ay = ay + 1
|
|
elif c == 'v':
|
|
ay = ay - 1
|
|
elif c == '<':
|
|
ax = ax - 1
|
|
elif c == '>':
|
|
ax = ax + 1
|
|
pos.append((ax, ay))
|
|
else:
|
|
if c == '^':
|
|
by = by + 1
|
|
elif c == 'v':
|
|
by = by - 1
|
|
elif c == '<':
|
|
bx = bx - 1
|
|
elif c == '>':
|
|
bx = bx + 1
|
|
pos.append((bx, by))
|
|
current = not current
|
|
print(len(set(pos)))
|