#include #include #include using namespace std; int main() { string route; cin >> route; int n = 0; int s = 0; int e = 0; int w = 0; for (int i = 0; i < route.length(); i++) { if (route[i] == 'N') { n++; } else if (route[i] == 'E') { e++; } else if (route[i] == 'W') { w++; } else { s++; } } int x = abs(e - w); int y = abs(n - s); double ans = sqrt(x*x + y*y); cout << ans << endl; return 0; }