Problem : 1088 ( Write a simple HTML Browser ) Judge Status : Accepted RunId : 5720130 Language : C++ Author : ssun Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta #include<iostream> #include<string> using namespace std; int main() { int count=0,i; string s; string ss; while(cin>>s) { int len = s.size(); if(s == "<br>") { ss += "\n"; count = 0; continue; } if(s == "<hr>") { if(count != 0) ss += "\n"; for(i=0; i<8; i++) ss += "----------"; ss += '\n'; count = 0; continue; } count += len; if(count > 80) { ss += "\n"; ss += s; count = len; continue; } if(count<=80) { if(count!=len && count!=80) ss += " "; count++; if(count > 80) { ss += "\n"; ss += s; count = len; } else ss += s; } } cout<<ss<<endl; return 0; }