Follows 391.c (Total 53 lines):

/* @JUDGE_ID:4461XX 391 C */
/* A */
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define max 1000
char a[max] ;
int yes=1 ;
int count( int i )
{
	int j , k ;
	for( j=i+1 , k=0 ; ; j++ , k++ ){
		if( isdigit( a[j] ) ) continue ;
		if( a[j] == '.' )	continue ;
		break ;
	}
	return k ;
}
int compare( int i )
{
	switch ( a[i+1] ){
		case 'b' : return 1 ;
		case 'i' : return 1 ;
		case 's' : return count( i+1 )+1 ;
		case '*' : return -1 ;
		default : if( yes ) printf( "%c" , a[i+1] ) ;
					 return 1 ;
	}
}
void main( void )
{

	int i , k ;
/*	freopen( "C:\\windows\\desktop\\391.in" , "r" , stdin ) ;
	freopen( "C:\\windows\\desktop\\391.out" , "w" , stdout ) ;*/
	while( gets( a ) ){
		for( i=0 ; i<strlen(a) ; i++ ){
			if( a[i] == '\\' ){
				k = compare( i ) ;
				if( k == -1 ){
					yes = !yes ;
					i++ ;
				}
				else{
					if( yes ) i += k ;
					else putchar( a[i] ) ;
				}
			}
			else putchar( a[i] ) ;
		}
		putchar( '\n' ) ;
	}
}

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