#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ string a, b; int a1=-1, b1=-1, t= 0; vector dir{"N", "E", "S", "W"}; cin >> a >> b; while(1){ if (a == dir[t]) a1 = t; if (b == dir[t]) b1 = t; if (a1 >= 0 && b1 >= 0) break; t++; } cout << ((b1 - a1)%4 + 4)% 4 << endl; }