#include using namespace std; using ll = long long; #define fi first #define se second #define all(a) a.begin(),a.end() int main(){ string s="NESW"; char a,b; cin >> a >> b; for(int i=0; i<4; ++i){ for(int j=0; j<4; ++j){ if(a==s[i] && b==s[j]){ cout << (j-i+4)%4 << endl; } } } return 0; }