#include #include #include using namespace std; int main() { string S; cin >> S; int ns = 0, ew = 0; for(int i = 0; i < S.length(); ++i) { if((S[i] == 'N') || (S[i] == 'S')) { ns += ((S[i] == 'N') ? 1 : -1); } else { ew += ((S[i] == 'E') ? 1 : -1); } } cout << sqrt((ns * ns) + (ew * ew)) << endl; return 0; }