UVa 10361 Automatic Poetry

简介:


复制代码
#include<iostream>
#include<string>
using namespace std;
int main()
{
long n;
cin>>n;
getchar();
for(long cas=1;cas<=n;cas++)
{
string a,b,ans;
getline(cin,a);
for(long i=0;a[i];i++)
if(a[i]!='<'&&a[i]!='>')
cout<<a[i];
cout<<endl;
// Print the First Line
getline(cin,b);
// Read In stringA and stringB

long j,pos[5]={0};
j=0;
for(long i=0;a[i];i++)
if(a[i]=='<'||a[i]=='>')
{
j++;
pos[j]=i;
}
// Get Four Positions

string _1="",_2="",_3="",_4="";
for(long i=pos[1]+1;i<=pos[2]-1;i++)
_1+=a[i];
for(long i=pos[2]+1;i<=pos[3]-1;i++)
_2+=a[i];
for(long i=pos[3]+1;i<=pos[4]-1;i++)
_3+=a[i];
for(long i=pos[4]+1;a[i];i++)
_4+=a[i];

ans="";
for(long i=0;b[i];i++)
{
if(b[i]!='.')
ans+=b[i];
else
{
ans+=_3+_2+_1+_4;
break;
}
}
cout<<ans<<endl;
// Print the Secont Line
}
return 0;
}
复制代码

==============================================================================
本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/archive/2012/03/21/2410761.html,如需转载请自行联系原作者
相关文章
|
6月前
UVA —10361—Automatic Poetry
UVA —10361—Automatic Poetry
uva 11991 - Easy Problem from Rujia Liu?
这个题目的意思是输入n个数,m组询问,每组询问包含两个整数k,v,意思是询问整数v第k次出现的位置。
41 0
UVa11958 - Coming Home
UVa11958 - Coming Home
48 0
|
Shell Windows
[记录condaのbug] CommandNotFoundError: Your shell has not been properly configured to use ‘conda...
[记录condaのbug] CommandNotFoundError: Your shell has not been properly configured to use ‘conda...
[记录condaのbug] CommandNotFoundError: Your shell has not been properly configured to use ‘conda...
【HDU 5572 An Easy Physics Problem】计算几何基础
2015上海区域赛现场赛第5题。 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5572 题意:在平面上,已知圆(O, R),点B、A(均在圆外),向量V。
1039 0