//继续字符串水题,这么水真的没什么可以解释了...哈哈
#include <stdio.h>
#include <string.h>
int main()
{char l[100], c[100];int N, i, t, b2, e2, b4, e4;scanf( "%d", &N );getchar();for( t = 0; t < N; t++ ){memset(l, 0, sizeof(l) );memset(c, 0, sizeof(c) );gets(l);gets(c);for( i = 0; i < strlen(l); i++ ){if( l[i] == '<' || l[i] == '>' )continue;elseprintf( "%c", l[i] );}printf( "\n" );for( i = strlen(l)-1; i >= 0; i-- ){if( l[i] == '>' )e4 = i;if( l[i] == '<' ){b4 = i;break;}}for( i = 0; i < strlen(l); i++ ){if( l[i] == '<' )b2 = i;if( l[i] == '>' ){e2 = i;break;}}for( i = 0; i < strlen(c); i++ ){if( c[i] == '.' ){for( i = b4+1; i < e4; i++ )printf( "%c", l[i] );for( i = e2+1; i < b4; i++ )printf( "%c", l[i] );for( i = b2+1; i < e2; i++ )printf( "%c", l[i] );for( i = e4+1; i < strlen(l); i++ )printf( "%c", l[i] );break;}elseprintf( "%c", c[i] );}printf( "\n" );}return 0;
}
详细解决方案
UVA 10361
热度:95 发布时间:2024-01-11 16:42:04.0