题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import sys
import re
a= input()
start = [0,0]
b = a.split(';')
oper = ['A','D','W','S']
for i in b:
if not 2 <=len(i)<=3:
continue
try:
if i[0] in oper:
step = int(i[1:])
if 0<= step <100:
if i[0] == 'A':
start[0] -= step
elif i[0] == 'D':
start[0] += step
elif i[0] == 'S':
start[1] -= step
elif i[0] == 'W':
start[1] += step
except:
continue
print(str(start[0])+','+str(start[1]))
