let line; while (line = readline()) { let x=0,y=0 const directions = line.split(';'); directions.forEach(item =>{ if(/^[A|S|D|W]\d{1,2}$/i.test(item)){ let first = item[0]; if(first === 'A'){ x-= item.slice(1); } ...