Follows 10701.c (Total 42 lines):
/* @JUDGE_ID:4461XX 10701 C */
/* A */
#include<stdio.h>
#include<string.h>
int stringLen;
char string1[80], string2[80];
char *root;
void findPost( char *in )
{
char rootChar;
char *index;
if( in==NULL )
return;
for( rootChar=*root,index=in; *index; ++index )
if( *index==rootChar ){
*index = NULL;
++root;
findPost( in );
findPost( index+1 );
putchar( rootChar );
break;
}
}
int main( void )
{
int cases;
scanf( "%d\n", &cases );
for( ; cases; --cases ){
scanf( "%d %s %s\n", &stringLen, string1, string2 );
root = string1;
findPost( string2 );
putchar( '\n' );
}
return 0;
}
Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com