#include using std::cin; using std::cout; using std::map; int main() { map mp; mp['W'] = 0; mp['N'] = 1; mp['E'] = 2; mp['S'] = 3; char a, b; cin >> a >> b; cout << (mp[b] - mp[a] + 4) % 4 << '\n'; return 0; }