#define NOMINMAX #define TEST_MODE true #define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include "bits/stdc++.h" #include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rep2(i,a,b) for(int i=(a);i<(int)(b);++i) #define rrep(i,n) for(int i=(n)-1;i>=0;--i) #define rrep2(i,a,b) for(int i=(a)-1;i>=(int)b;--i) #define range(i,a,b,c) for(int i=a;c>0?ib;i+=c) #define chmax(a,b) (a=(a)<(b)?(b):(a)) #define chmin(a,b) (a=(a)>(b)?(b):(a)) //templatevoid out(T a) {T b=a;if(a==inf)b=-1;cout< eps) - (r < -eps); } int sgn(const Real& a, const Real& b) { return sgn(a - b); } const int MAX = (int)2e6 + 5; const int MAX2 = 2005; vector split(const string& str, char sep) { vector v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) v.push_back(buffer); return v; } string join(const vector& v, const string delim = 0) { string s; if (!v.empty()) { s += v[0]; for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) { if (delim != "")s += delim; s += v[i]; } }return s; } string operator*(const string& s, const int& n) { string res = ""; rep(i, n)res += s; return res; } template int sum_f(T a) { return accumulate(all(a), 0ll); } templateT gcd(T a, T b) { T c; while (a != 0) { c = a; a = b % a; b = c; }; return b; } templateT bit_count(T N) { T c = 0; while (N) { if (N & 1)c++; N >>= 1; }return c; } templatevoid p_vector(vector> a, ostream& o = cout) { rep(i, a.size())o << a[i].first << "," << a[i].second << " "; o << endl; } templatevoid p_vector(vector a, ostream& o = cout) { rep(i, a.size() - 1)o << a[i] << " "; o << a.back() << endl; } ll pow_n(ll x, ll n) { ll r = 1; while (n > 0) { if (n & 1)r = (r * x) % mod_n; x = (x * x) % mod_n; n >>= 1; }return r; } int H, W; #define grid_ng(y,x) (y<0||y>=H||x<0||x>=W) int div_ceil(int a, int b) { int r = a / b; if (a % b != 0)r++; return r; } int math_div(int x, int m) { ll r = (x % m + m) % m; return (x - r) / m; } #define i1(a) cin>>a; #define i2(a,b) cin>>a>>b; #define i3(a,b,c) cin>>a;i2(b,c); #define i4(a,b,c,d) cin>>a;i3(b,c,d); #define i5(a,b,c,d,e) cin>>a;i4(b,c,d,e); template vector in_vec(int n) { vector a(n); a.resize(n); rep(i, n) cin >> a[i]; return a; } template vector> in_vec(int n, int m) { vector> a(n); rep(i, n) { a[i].resize(m); rep(j, m) cin >> a[i][j]; } return a; } template void out(First first) { cout << first << endl; } template void out(First first, Rest... rest) { cout << first << " "; out(rest...); } template auto make_vec(const size_t(&d)[n], const T& init) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec(d, init)); else return init; } template auto make_vec(const size_t(&d)[n]) noexcept { return make_vec(d, T{}); } bool is_bit_on(int b, int i) { return (b >> i) & 1; } template vector python_map(functionf, vectorxs) { vector ys; for (X x : xs) { auto y = f(x); ys.push_back(y); } p_vector(ys); return ys; }; struct Point { int y, x; }; // end of template int f(string s) { if (s == "E") return 0; if (s == "S") return 1; if (s == "W") return 2; return 3; } void solve() { string s, t; cin >> s >> t; int a = f(s); int b = f(t); if (a > b) b += 4; out(b - a); } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); solve(); return 0; }