#include #include #include using namespace std; int main(){ string h; cin >> h; int x = 0; int y = 0; int next = 0; double ans; while (1){ int loc = h.find("N", next); if (loc == string::npos){ break; } else{ next = loc+1; } y += 1; } next = 0; while (1){ int loc = h.find("E", next); if (loc == string::npos){ break; } else{ next = loc + 1; } x += 1; } next = 0; while (1){ int loc = h.find("W", next); if (loc == string::npos){ break; } else{ next = loc + 1; } x -= 1; } next = 0; while (1){ int loc = h.find("S", next); if (loc == string::npos){ break; } else{ next = loc + 1; } y -= 1; } ans = sqrt(x*x + y*y); cout << ans << endl; return 0; }