#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); char a, b; cin >> a >> b; map d; d['E'] = 0; d['S'] = 1; d['W'] = 2; d['N'] = 3; cout << (d[b] - d[a] + 4) % 4 << endl; }