//inlclude前用define #define _USE_MATH_DEFINES //include #include #include #include #include #include using namespace std; //typedef typedef vector VI; typedef vector VS; typedef vector VC; int main() { int x = 0, y = 0; string s; cin >> s; int size = s.size(); for (int i = 0; i < size; i++) { if (s[i] == 'N') { y++; }else if (s[i] == 'E') { x++; }else if (s[i] == 'W') { y--; }else if (s[i] == 'S') { x--; } } if (x < 0) x *= -1; if (y < 0) y *= -1; cout << sqrt(pow(x, 2) + pow(y, 2)) << endl; return 0; }