uva 10361 Automatic Poetry

题目:10361 - Automatic Poetry

思路:水题。。暴力

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char str[110];
string s[6];
int main()
{
    int t;
    scanf("%d",&t);
    getchar();
    while(t--)
    {
        gets(str);
        for(int i=0;i<=5;i++)
            s[i]="";
        int l=strlen(str);
        int i=0;
        while(str[i]!='<')
        {
            s[0]+=str[i];
            i++;
        }
        i++;
        while(str[i]!='>')
        {
            s[1]+=str[i];
            i++;
        }
        i++;
        while(str[i]!='<')
        {
            s[2]+=str[i];
            i++;
        }
        i++;
        while(str[i]!='>')
        {
            s[3]+=str[i];
            i++;
        }
        i++;
        while(i<l)
        {
            s[4]+=str[i];
            i++;
        }
        gets(str);
        i=0;
        while(1)
        {
            if(str[i]=='.'&&str[i+1]=='.'&&str[i+2]=='.')
                break;
            s[5]+=str[i];
            i++;
        }
        for(int i=0;i<=4;i++)
            cout<<s[i];
        cout<<endl;
        swap(s[1],s[3]);
        cout<<s[5];
        for(int i=1;i<=4;i++)
            cout<<s[i];
        cout<<endl;
    }
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/overflow/p/3139149.html