简单模拟
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream> #include <string> using namespace std; string html; void work() { bool begin=true; int now=0,temp=0,i; string word; while (cin>>word) { if (word=="<br>") { cout<<endl; now=0; continue; } if (word=="<hr>") { if (now!=0) cout<<endl; for (i=1;i<=80;i++) cout<<"-"; cout<<endl; now=0; continue; } if (now==0?now+word.length()<=80:now+word.length()+1<=80) { if (now!=0) cout<<" "; cout<<word; now=now==0?now+word.length():now+word.length()+1; continue; } else { cout<<endl<<word; now=word.length(); } } } int main() { // freopen("t.txt","r",stdin); // freopen("t1.txt","w",stdout); work(); cout<<endl; return 0; }