题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
values = input().split(';')
beg = [0,0]
for value in values:
try:
if 2<= len(value) <= 3 and 0 <= int(value[1:]) <=99:
if value[0] == 'A':
beg[0] = beg[0]-int(value[1:])
elif value[0] == 'S':
beg[1] = beg[1]-int(value[1:])
elif value[0] == 'D':
beg[0] = beg[0]+int(value[1:])
elif value[0] == 'W':
beg[1] = beg[1]+int(value[1:])
except:
continue
print(str(beg[0]) + ',' + str(beg[1]))