#include #include #include #define READ_BUFSIZE ( 128 ) #define READ_DELIMITER ( " " ) //標準入力取得(1行) int GetStdin( char* pszStr, int lMaxLen ) { int lLen = 0; memset( pszStr, 0, lMaxLen ); if( fgets( pszStr, lMaxLen, stdin ) ) { lLen = strlen( pszStr ); if( lLen >= 1 ) { if( pszStr[ lLen - 1 ] == 0x0A ) { pszStr[ lLen - 1 ] = 0; lLen--; } } } return( lLen ); } int main(int argc, char *argv[]) { char szRead[READ_BUFSIZE] = ""; //char* psOutbuf[10000] = { 0 }; //int lInput[10] = {0}; int lLen = GetStdin( szRead, READ_BUFSIZE ); char* pEast = strstr( szRead, "OOO" ); char* pWast = strstr( szRead, "XXX" ); if( pEast == 0 ) { if( pWast == 0 ) printf( "NA\n" ); else printf( "West\n" ); } else { if( pWast == 0 ) printf( "East\n" ); else if( pEast > pWast ) printf( "West\n" ); else printf( "East\n" ); } return 0; }