题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
直接粗暴 纯逻辑
dic={'A':[-1,0],'W':[0,1],'S':[0,-1],'D':[1,0]}
x,y=0,0
arr=input().split(';')
for i in arr:
if (0<len(i)<=3):
if (i[0] in dic):
if i[1:].isdecimal():
x += int(i[1:])*dic[i[0]][0]
y += int(i[1:])*dic[i[0]][1]
print(x,end=',')
print(y)
x,y=0,0
arr=input().split(';')
for i in arr:
if (0<len(i)<=3):
if (i[0] in dic):
if i[1:].isdecimal():
x += int(i[1:])*dic[i[0]][0]
y += int(i[1:])*dic[i[0]][1]
print(x,end=',')
print(y)