forked from daiwb/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1099HTML.cpp
More file actions
47 lines (41 loc) · 894 Bytes
/
1099HTML.cpp
File metadata and controls
47 lines (41 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//ZJU 1099 HTML
//2003.08.13 BY ADAI
#include <iostream>
#include <cstring>
using namespace std;
int main(void){
char c[85];
int len,clen,i;
len=0;
while(cin>>c){
if(strcmp(c,"<br>")==0){
cout<<endl;
len=0;
}
else if(strcmp(c,"<hr>")==0){
if(len>0) cout<<endl;
for(i=0;i<80;i++) cout<<"-";
cout<<endl;
len=0;
}
else{
clen=strlen(c);
if(len==0){
cout<<c;
len=clen;
}
else{
if(len+1+clen<=80){
cout<<" "<<c;
len+=1+clen;
}
else{
cout<<endl<<c;
len=clen;
}
}
}
}
cout<<endl;
return 0;
}