#include #define rep(i,n) for(int i=0; i< (n); i++) using namespace std; typedef long long ll; typedef pair P; const int mod = 998244353; const int inf = (1<<30); const ll INF = (1ull<<62); int f(char c){ if(c == 'E') return 0; if(c == 'W') return 2; if(c == 'S') return 1; if(c == 'N') return 3; return 0; } int main(){ int a,b; char c; cin>>c; a = f(c); cin>>c; b = f(c); cout<<(b+4-a)%4<