#include using namespace std; int main(void){ char a, b; cin >> a >> b; string s = "NESW"; int n, w; for (int i = 0; i < 4; i++) { if (s[i] == a) n = i + 1; if (s[i] == b) w = i + 1; } int ans; if (n > w) { ans = 4 - w; } else ans = w - n; cout << ans << endl; }