class Program { static void Main(string[] args) { string direction = Console.ReadLine()!; double xCount = 0; double yCount = 0; foreach (char c in direction) { if (c == 'N') { yCount++; } else if (c == 'E') { xCount++; } else if (c == 'W') { xCount--; } else { yCount--; } } if (xCount < 0) { xCount *= -1; } else if (yCount < 0) { yCount *= -1; } double ans = xCount * xCount + yCount * yCount; ans = Math.Sqrt(ans); Console.WriteLine(ans); } }