#include #include #include using namespace std; using namespace atcoder; #define rep(i, l, n) for (int i = (l); i < (n); i++) #define ite(i, a) for(auto& i : a) #define all(x) x.begin(), x.end() #define lb lower_bound #define ub upper_bound #define lbi(A, x) (ll)(lb(all(A), x) - A.begin()) #define ubi(A, x) (ll)(ub(all(A), x) - A.begin()) using ll = long long; using Pair = pair; template using V = vector; template using VV = V >; const ll INF = 1000000000000000001; const int inf = 1001001001; const ll mod = 1000000007; const ll MOD = 998244353; template inline V getList(int n) { V res(n); rep(i, 0, n) { cin >> res[i]; }return res; } template inline VV getGrid(int m, int n) { VV res(m, V(n)); rep(i, 0, m) { res[i] = getList(n); }return res; } inline V dtois(string& s) { V vec = {}; for (auto& e : s) { vec.push_back(e - '0'); } return vec; } int main(void) { string d = "NESWNESW"; char a, b; cin >> a >> b; int ans = 0; rep(i, 0, 4) { if (d[i] == a) { rep(j, 0, 4) { if (d[i + j] == b) { cout << j << endl; return 0; } } } } return 0; }