emacs初体验,真不习惯。那个缩进竟然是两个空格,还有每次换行都要按Tab键。。。
感觉代码看起来很乱。。。
只是知道那么一点点,还是继续练吧。
题目很简单,水题。
AC代码如下:
1 #include<stdio.h> 2 #include<string.h> 3 4 int main() 5 { 6 int i, t1, t2, t3, T, t4, n, m; 7 char s1[105], s2[105]; 8 scanf("%d%*c", &T); 9 while(T--){ 10 gets(s1); 11 gets(s2); 12 n=strlen(s1); 13 m=strlen(s2); 14 t1=t2=t3=t4=0; 15 for (i=0; i<n; i++){ 16 if (s1[i] != '<' && s1[i] != '>'){ 17 printf("%c", s1[i]); 18 } 19 if (s1[i] == '<'){ 20 if (t1==0){ 21 t1=i+1; 22 } 23 else{ 24 t3=i+1; 25 } 26 } 27 if (s1[i] == '>'){ 28 if (t2 == 0){ 29 t2=i+1; 30 } 31 else{ 32 t4=i+1; 33 } 34 } 35 } 36 printf("\n"); 37 for (i=0; i<m; i++){ 38 if (s2[i] != '.'){ 39 printf("%c", s2[i]); 40 } 41 } 42 for (i=t3; i<t4-1; i++){ 43 printf("%c", s1[i]); 44 } 45 for (i=t2; i<t3-1; i++){ 46 printf("%c", s1[i]); 47 } 48 for (i=t1; i<t2-1; i++){ 49 printf("%c", s1[i]); 50 } 51 for (i=t4; i<n; i++){ 52 printf("%c", s1[i]); 53 } 54 printf("\n"); 55 } 56 return 0; 57 }