- #include<iostream>
- #include<string>
- using namespace std;
- int re(80);
- int main()
- {
- freopen("in.txt","r",stdin);
- freopen("out.txt","w",stdout);
- string temp;
- int i,l,j;
- while(cin>>temp)
- {
- l=temp.size();
- if(temp=="<br>")
- {
- cout<<endl;
- re=80;
- continue;
- }
- if(temp=="<hr>")
- {
- if(re!=80)
- {
- cout<<endl;
- cout<<"--------------------------------------------------------------------------------"<<endl;
- }
- else
- cout<<"--------------------------------------------------------------------------------"<<endl;
- re=80;
- continue;
- }
- if(l>=re)
- {
- cout<<endl;
- cout<<temp;
- re=80-l;
- continue;
- }
- if(re==80)
- {
- cout<<temp;
- re=re-l-1;
- continue;
- }
- if(l+1<=re)
- {
- cout<<" "<<temp;
- re=re-l-1;
- }
- else
- {
- cout<<endl;
- cout<<temp;
- re=80-l;
- }
- }
- cout<<endl;
- return 0;
- }
2271
最新推荐文章于 2022-07-24 22:14:30 发布