#include using namespace std; #define rep(i,a,b) for(LL i = a;i=b; i--) #define INF ((1LL<<62)-(1LL<<31)) #define ooki 9,223,372,036,854,775,807 #define tii -9,223,372,036,854,775,808 typedef long long LL; int main(){ char a,b;int c,d; cin>>a>>b; if(a=='N'){ c=1;} if(a=='E'){ c=2;} if(a=='S'){ c=3;} if(a=='W'){ c=4;} if(b=='N'){ d=1;} if(b=='E'){ d=2;} if(b=='S'){ d=3;} if(b=='W'){ d=4;} if(a==b){cout<<0<