您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

13 行
264B

  1. import sys
  2. from itertools import accumulate as acc
  3. text = sys.stdin.read()
  4. dirs = dict(zip('<>^v', [-1, 1, -1j, 1j]))
  5. ans1 = len({*acc(map(dirs.get, text))})
  6. print(ans1)
  7. ans2 = len({*acc(map(dirs.get, text[::2])), *acc(map(dirs.get, text[1::2]))})
  8. print(ans2)