题解 | #坐标移动#
坐标移动
https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
s = input().split(';')
res = [0,0]
for i in range(len(s)):
if len(s[i]) < 2 or len(s[i]) > 3:
continue
elif s[i][0] in ['A', 'D', 'W', 'S'] and s[i][1:].isdigit():
if s[i][0] == 'A':
res[0] -= int(s[i][1:])
if s[i][0] == 'D':
res[0] += int(s[i][1:])
if s[i][0] == 'W':
res[1] += int(s[i][1:])
if s[i][0] == 'S':
res[1] -= int(s[i][1:])
else:
continue
print(str(res[0]) + ',' + str(res[1]))