using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input1"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("NE"); //1.41421 } else if (InputPattern == "Input2") { WillReturn.Add("EN"); //1.41421 } else if (InputPattern == "Input3") { WillReturn.Add("SSSSWWW"); //5 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); string S = InputList[0]; double HeniX = 0, HeniY = 0; HeniX += S.Count(A => A == 'E'); HeniX -= S.Count(A => A == 'W'); HeniY += S.Count(A => A == 'S'); HeniY -= S.Count(A => A == 'N'); Console.WriteLine(Math.Sqrt(HeniX * HeniX + HeniY * HeniY)); } }