Follows 536.c (Total 31 lines):

/* @JUDGE_ID:4461XX 536 C */
/* A */
#include<stdio.h>
#include<string.h>
int pre_tail ;
char pre[30] , in[30] ;
void print( int from , int end )
{
	int i ;
	if( from > end ) return ;
	else{
		pre_tail++ ;
		for( i=0 ; in[i] ; i++ )
			if( pre[pre_tail]==in[i] ){
				print( from , i-1 ) ;
				print( i+1 , end ) ;
				putchar( in[i] ) ;
				break ;
			}
	}
}
void main( void )
{
/*  freopen( "C:\\windows\\desktop\\536.in" , "r" , stdin ) ;*/
	while( scanf( "%s %s\n" , pre , in ) == 2 ){
		pre_tail = -1 ;
		print( 0 , strlen( in ) - 1 ) ;
		putchar( '\n' ) ;
	}
}
/* @END_OF_SOURCE_CODE */

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