using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { // 要素を作成 var news = new Dictionary() { {"N", 1 }, {"E", 2 }, {"S", 3 }, {"W", 4 }, }; // 標準入力取得 var pStart = Console.ReadLine(); var pEnd = Console.ReadLine(); if ( pStart == pEnd) { Console.WriteLine("0"); } else { // 絶対値として工程を算出 var ans = Math.Abs((4 - news[pStart]) - news[pEnd]); Console.WriteLine(ans); } } }