#include using namespace std; int main() { vector dir = {'E', 'S', 'W', 'N'}; char a, b; cin >> a >> b; int an = 0; int bn = 0; for(int i = 0; i < 4; i++) { if(dir[i] == a) an = i; if(dir[i] == b) bn = i; } cout << (bn - an + 4) % 4 << endl; return 0; }