题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
s = input().split(';') #A10;S20;W10;D30;X;A1A;B10A11;;A10;
start = [0,0]
for i in s:
if not 2 <= len(i) <= 3:
continue
try:
dd = i[0]
step = int(i[1:])
if dd in ['A','W','D','S']:
if 0 <= step <= 99:
if dd == 'A':
start[0] -= step
elif dd == 'D':
start[0] += step
elif dd == 'W':
start[1] += step
elif dd == 'S':
start[1] -= step
except:
continue
print(str(start[0]) + ',' + str(start[1]))

