题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
x = 0
y = 0
x_dict = {'A': -1, 'D': 1}
y_dict = {'W': 1, 'S': -1}
my_list = list(input().strip().split(';'))
my_list.remove('')
for item in my_list:
if len(item) > 3 or len(item) < 2:
my_list.remove(item)
for item in my_list:
cmd = item[0]
if item[1:].isdigit():
value = int(item[1:])
else:
continue
if cmd in x_dict:
x = x + x_dict[cmd] * value
elif cmd in y_dict:
y = y + y_dict[cmd] * value
print(str(x) + ',' + str(y))