#include using namespace std; int main() { char A, B; cin >> A >> B; string s = "ESWN"; int a, b; for( int i = 0; i < 4; i++ ) { if( s[i] == A ) a = i; if( s[i] == B ) b = i; } int ans = b - a; if( ans < 0 ) ans += 4; cout << ans << endl; }