#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
#include <functional>
using namespace std;
#define diff(x,y) ((x > y) ? (x - y) : (y - x))
#define us(x) (x > 0) ? x : x * -1
#define lli long long int
const int MAX = 10000001;

int main() {
	string str;
	cin >> str;
	int x, y;
	int n = 0, e = 0, s = 0, w = 0;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'N')		n++;
		else if (str[i] == 'E')	e++;
		else if (str[i] == 'S') s++;
		else					w++;
	}
	x = diff(n, s);
	y = diff(e, w);
	cout << sqrt(pow(x, 2) + pow(y, 2)) << endl;
	return 0;
}