题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
input_list = input().split(";")
init = [0, 0]
derect = "AWSD"
for item in input_list:
if len(item) <= 0:
continue
derection = item[0]
steps = item[1::]
if derection in derect and steps.isdigit():
if derection == "A":
init[0] -= int(item[1::])
elif derection == "D":
init[0] += int(item[1::])
elif derection == "W":
init[1] += int(item[1::])
elif derection == "S":
init[1] -= int(item[1::])
else:
continue
print(str(init[0]) + "," + str(init[1]))