#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
int count=0;
while(cin>>str)
{
if(str=="<br>")
{
cout<<endl;
count=0;
continue;
}
if(str=="<hr>")
{
if(count>0)
cout<<endl;
for(int i = 0; i < 80; i++)
cout << '-';
cout<<endl;
count=0;
continue;
}
if(count==0)
{
cout<<str;
count=str.length();
continue;
}
if(count+str.length()+1<=80)
{
count=count+str.length()+1;
cout<<" "<<str;
continue;
}
else
{
count=str.length();
cout<<endl;
cout<<str;
}
}
cout<<endl;
return 0;
}
转载于:https://www.cnblogs.com/wanglee1027/archive/2012/05/08/2489887.html