小模拟题
推荐使用py来写,方便快捷,可以直接指定输入用";"来分割,省去了很多不必要的操作
commands = input().split(";") x, y = 0, 0 for cmd in commands: if len(cmd) < 2 or len(cmd) > 3: continue c = cmd[0] if c not in "ADWS": continue p = cmd[1:] if p.isdigit() and 1 <= int(p) <= 99: p = int(p) if c == "A": x -= p elif c == "D": x += p elif c == "W": y += p elif c == "S": y -= p print(f"{x},{y}")