#include <iostream> #include <cassert> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); vector<char> d = { 'N', 'E', 'S', 'W', 'N', 'E', 'S', 'W' }; char a, b; cin >> a >> b; int pos = -1; for (int i = 0; i < 4; i++) { if (d[i] == a) pos = i; } for (int i = 0; i < 8 - pos; i++) { if (d[i + pos] == b) { cout << i << endl; return 0; } } return 0; }