题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
import re
input_str = input()
coordinate_li = input_str.split(";")
res_li = [i for i in coordinate_li if re.match("^(A|S|D|W)\d+$", i)]
m,n = 0,0
if len(res_li) != 0:
for i in res_li:
if i.find('A') != -1:
m -= int(i[1:])
elif i.find('D') != -1:
m += int(i[1:])
elif i.find('W') != -1:
n += int(i[1:])
elif i.find('S') != -1:
n -= int(i[1:])
else:
pass
print("%s,%s" % (m, n))
