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