题解 | #没有重复项数字的全排列#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
JS+正则表达式
let a = readline().split(';')
let [x, y] = [0, 0]
let reg = /^[A,D,W,S][0-9]{1,2}$/
for (let i = 0; i < a.length; i++) {
if (reg.test(a[i])) {
// console.log(a[i])
let num = parseInt(a[i].slice(1))
switch (a[i].charAt(0)) {
case 'A':
x -= num
break
case 'D':
x += num
break
case 'W':
y += num
break
case 'S':
y -= num
default:
break
}
}
}
console.log(x+','+y)