#include #include #include using namespace std; int main() { string S; cin >> S; int x = 0; int y = 0; for (char c : S) { int i = 0; for (char news : "NESW") { if (c == news) { int sgn = i < 2 ? 1 : -1; x += sgn * (i % 2); y += sgn * ((i + 1) % 2); } i++; } } cout << sqrt(x * x + y * y) << endl; }