#define _USE_MATH_DEFINES //M_PI #include //std::cout, std::cin #include //std::string #include //std::vector #include //std::valarray 数値のみの一次配列 #include //std::sort #include //localtime_s #include //abs #include //abs, std::pow, sqrt, sin, cos, #include //std::ifstream #include //std::setprecision #include //std::random(C++11) #include //std::accumulate int main(void) { //test用 //std::ifstream in("test.txt"); //std::cin.rdbuf(in.rdbuf()); std::string S; std::cin >> S; int x = 0, y = 0; for (int i = 0; i < S.length(); i++) { switch (S[i]) { case 'N':y++; break; case 'E':x++; break; case 'W':x--; break; case 'S':y--; break; } } std::cout << std::setprecision(10) << sqrt(x*x + y*y) << std::endl; }