PersonalCorpus 版 (精华区)

1122046 2002/09/27 08:18:14.460 Accepted 0:00.000
64 18188 C++ 10361 - Automatic Poetry


void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\uva\\contest9-13\\inputI.txt","r",stdin);
    freopen("c:\\0acm\\uva\\contest9-13\\outputI.txt","w",stdout);
#endif
    int i,j,k,n;
    char a[200],b[200];
    char sa[200],sb[200];
    char s1[100],s2[100],s3[100],s4[100],s5[100];

    scanf("%d\n",&n);
    while (n>0) {
        n--;
        gets(a); strcpy(sa,a);
        gets(b); strcpy(sb,b);
        i=0;
        j=i; while (a[j]!='<') j++;
        a[j]=0;
        strcpy(s1,a+i);
        i=j+1;
        j=i; while (a[j]!='>') j++;
        a[j]=0;
        strcpy(s2,a+i);
        i=j+1;
        j=i; while (a[j]!='<') j++;
        a[j]=0;
        strcpy(s3,a+i);
        i=j+1;
        j=i; while (a[j]!='>') j++;
        a[j]=0;
        strcpy(s4,a+i);
        i=j+1;
        strcpy(s5,a+i);

        for (i=0;i<strlen(sa);i++) if ((sa[i]!='>')&&(sa[i]!='<'))
            printf("%c",sa[i]);
        printf("\n");

        for (i=0;i<strlen(sb)-3;i++) printf("%c",sb[i]);
        printf("%s%s%s%s\n",s4,s3,s2,s5);
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.158毫秒