#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
    string s;
    cin >>s;
    int x{}, y{};
    for (auto i : s) {
        if (i == 'E') x++;
        else if ( i == 'W') x--;
        else if ( i == 'N') y++;
        else y--;
    }
    x = abs(x);
    y = abs(y);
    double ans = sqrt(x * x + y * y);
    cout << ans << endl;
    return 0;
}