//poj 2271
//sep9
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
int i,cnt=0;
while(cin>>s){
if(s=="<br>"){
cout<<endl;
cnt=0;
}else if(s=="<hr>"){
if(cnt)
cout<<endl;
for(int i=0;i<80;++i)
cout<<"-";
cout<<endl;
cnt=0;
}else{
if(cnt+s.length()+(cnt==0?0:1)>80){
cout<<endl<<s;
cnt=s.length();
}else{
if(cnt){
cout<<" "<<s;
cnt+=s.length()+1;
}else{
cout<<s;
cnt+=s.length();
}
}
}
}
return 0;
}
poj 2271 HTML 模拟
最新推荐文章于 2018-06-12 23:25:47 发布