Follows 271.c (Total 47 lines):

/* @JUDGE_ID:4461XX 271 C "Aǰt" */
/* A */
#include<stdio.h>
#include<string.h>
#define MAX 256

int Check( char *in )
{
	int count , i ;

	for( i=strlen( in )-1,count=0 ; i>=0 ; --i ){
		switch( in[i] ){
			case 'p' :
			case 'q' :
			case 'r' :
			case 's' :
			case 't' :
			case 'u' :
			case 'v' :
			case 'w' :
			case 'x' :
			case 'y' :
			case 'z' : ++count ; break ;
			case 'N' : break ;
			case 'C' :
			case 'D' :
			case 'E' :
			case 'I' : --count ; break ;
			default : return 0 ;
		}

		if( count<=0 ) return 0 ;
	}

	if( count==1 ) return 1 ;
	return 0 ;
}
int main( void )
{
	char in[MAX+1] ;

	while( gets( in ) )
		if( Check( in ) ) puts( "YES" ) ;
		else puts( "NO" ) ;

	return 0 ;
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com