#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int i, j, k; string s; cin >> s; int cnth = 0, cntn = 0; int flag = 0; // 1=higasi 2=nisi for (i = 0; i < s.length(); i++) { if (s[i] == 'O') { if (flag == 1) { cnth++; if (cnth == 3) { cout << "East" << endl; break; } } else { flag = 1; cntn = 0; cnth = 1; } } else if (s[i] == 'X') { if (flag == 2) { cntn++; if (cntn == 3) { cout << "West" << endl; break; } } else { flag = 2; cnth = 0; cntn = 1; } } } if (cnth != 3 && cntn != 3) { cout << "NA" << endl; } getchar(); getchar(); return 0; }