这道题唯一可能存在的难点就是如何判断是不是合法的坐标
let list=['A','D','W','S']
console.log(readline().split(';').reduce((pre,cur)=>{
if(cur.length==2&&list.indexOf(cur[0])>=0&&!isNaN(cur[1])){
return move(pre,cur[0],parseInt(cur[1]))
}else if(cur.length==3&&list.indexOf(cur[0])>=0&&!isNaN(cur[1])&&!isNaN(cur[2])){
return move(pre,cur[0],parseInt(cur[1]+cur[2]))
}
return pre
},[0,0]).join(','))
function move(pre,type,d){
if(type=='A'){
pre[0]-=d
}else if(type=='S'){
pre[1]-=d
}else if(type=='W'){
pre[1]+=d
}else if(type='D'){
pre[0]+=d
}
return pre
}