题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import sys
for line in sys.stdin:
a = line.split(";")[:-1]
d={}
l=['A','D','W','S']
for i in a:
if i != '':
if i[0] not in d and i[0] in l:
if i[1:].isdigit():
d[i[0]]=int(i[1:])
elif i[0] in d and i[0] in l:
if i[1:].isdigit():
d[i[0]]+=int(i[1:])
else:
pass
result=[d['D']-d['A'],d['W']-d['S']]
print(",".join([str(x) for x in result]))