#include using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair; #define INF LONG_MAX #define MOD1 1000000007 #define MOD2 998244353 #define MOD MOD1 #define rng(a) a.begin(),a.end() #define rrng(a) a.end(),a.begin() #define endl "\n" int main(){ ios::sync_with_stdio(false); cin.tie(0); mapm; m['E']=0; m['S']=1; m['W']=2; m['N']=3; char A,B; cin>>A>>B; cout<<(m[B]-m[A]+4)%4<