#include using namespace std; using ll = long long; double x, y; int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 'N') y++; else if (s[i] == 'S') y--; else if (s[i] == 'W') x++; else x--; } cout << sqrt(x * x + y * y) << endl; }