using System; using System.Linq; class Program { const char North = 'N'; const char East = 'E'; const char West = 'W'; const char South = 'S'; static void Main(string[] args) { var line = Console.ReadLine().ToCharArray().OrderBy(x => x).ToList(); int nCnt = line.Count(x => x == North); int eCnt = line.Count(x => x == East); int wCnt = line.Count(x => x == West); int sCnt = line.Count(x => x == South); int horizontal = Math.Abs(nCnt - sCnt); int vartical = Math.Abs(eCnt - wCnt); var dist = Math.Sqrt( Math.Pow(horizontal, 2) + Math.Pow(vartical, 2) ); Console.WriteLine(Math.Round(dist,5, MidpointRounding.AwayFromZero)); return; } }