function Main(input) { // 方角:北東南西:0123 const d = ["N", "E", "S", "W"]; const src = input.split("\n") const a = d.indexOf(src[0]); const b = d.indexOf(src[1]); const ans = (b - a + 4) % 4; console.log(ans); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));