2271
来源:互联网 发布:ugui源码深度剖析 编辑:程序博客网 时间:2024/06/06 03:04
- #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;
- }