原题连接:
https://vjudge.net/problem/UVA-10361
AC代码:
#include <bits/stdc++.h>
using namespace std;
void getsi(char str[])
{
char c;
int i = 0;
while (c = getchar())
{
if (c != '<' && c != '>' && c != '\n')
{
str[i++] = c;
}
else
{
str[i] = '\0';
return;
}
}
}
int main()
{
int n;
cin >> n;
getchar();
while (n--)
{
char s1[101], s2[101], s3[101], s4[101], s5[101], s[101];
getsi(s1);
getsi(s2);
getsi(s3);
getsi(s4);
getsi(s5);
fgets(s, 101, stdin);
s[strlen(s) - 4] = '\0';
cout << s1 << s2 << s3 << s4 << s5 << endl;
cout << s << s4 << s3 << s2 << s5 << endl;
}
return 0;
}
参考了网上大佬的思路,精简美观
自己写的就乱七八糟,我果然还是太菜了