// ============================================== // Library // ============================================== #define _CRT_SECURE_NO_WARNINGS // When you are using the gcc compiler, you need only the following lines. // #include // When you are using other compilers, you need the following line instead. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // competitive macro #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--) #define LL long long #define ULL unsigned long long // const const ULL mod = 1000000007; // If you use this function, "cin" speeds up. // However, you can not mix "cin" and "scanf", "cout" and "printf". void fastIOS() { cin.tie(0); ios::sync_with_stdio(false); } // ============================================== // ============================================== int main() { fastIOS(); string s; cin >> s; int sSize = s.size(); int cntE = 0; int cntW = 0; REP(i, sSize) { if (s[i] == 'O') { cntE++; cntW = 0; } else if (s[i] == 'X') { cntW++; cntE = 0; } if (cntE == 3) { cout << "East" << "\n"; return 0; } else if (cntW == 3) { cout << "West" << "\n"; return 0; } } cout << "NA" << "\n"; return 0; }