题解 | 坐标移动
import re pattern = r'^[ASDW]\d+$' a = input().split(';') position = [0,0] for i in a: match = re.match(pattern , i) if match: if i[0] == "A": position[0] -= int(i[1:]) if i[0] == "D": position[0] += int(i[1:]) if i[0] == "S": position[1] -= int(i[1:]) if i[0] == "W": position[1] += int(i[1:]) result = ",".join(str(item) for item in position) print(result)