1 #include <iostream> 2 #include <string> 3 #include <queue> 4 5 using namespace std; 6 queue<string>myq; 7 string str1 = "<br>", str2 = "<hr>"; 8 9 int main() { 10 int count = 0; 11 string str3; 12 while (cin >> str3) 13 myq.push(str3); 14 while (!myq.empty()) { 15 str3 = myq.front(); 16 17 if (str3 == str1) { 18 cout << endl; 19 count = 0; 20 myq.pop(); 21 continue; 22 } 23 24 if (str3 == str2) { 25 if (count != 0) 26 cout << endl; 27 for (int i = 0; i < 80; i++) 28 cout << "-"; 29 cout << endl; 30 count = 0; 31 myq.pop(); 32 continue; 33 } 34 35 if (count + str3.size()+1 > 80) { 36 cout << endl; 37 cout << str3; 38 count = str3.size(); 39 } 40 else { 41 if (count == 0) { 42 cout << str3; 43 count = str3.size(); 44 } 45 else { 46 cout << " " << str3; 47 count += str3.size()+1; 48 } 49 50 } 51 myq.pop(); 52 } 53 cout << endl; 54 //system("pause"); 55 return 0; 56 }
HDU 1088 Write a simple HTML Browser
自己选的路,跪着也要把它走完------ACM坑