#include #include #include using namespace std; #define REP(i,n) for (int i=0;i<(n);i++) int main() { int x = 0, y = 0; string str; cin >> str; REP(i, str.size()) { switch (str[i]) { case 'E': x++; break; case 'W': x--; break; case 'N': y++; break; default: y--; break; } } cout << sqrt(x * x + y * y) << endl; return 0; }