-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.c
55 lines (47 loc) · 1.1 KB
/
rules.c
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
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
char buffer;
int header = 1;
int phase = 0;
int charger = 0;
char str[25];
void main() {
scanf("%s", str);
while((buffer = getchar()) != EOF){
if (phase == 0 && header == 1){
printf("<h4>");
header = 2;
printf("%s", str);
}
if (header == 2 && buffer == '\n'){
printf("</h4>");
header = 0;
}
if (buffer == '\n' && charger == 0 && phase == 1){
printf("</li>");
}
if ((charger == 1 || charger == 2) && phase == 1 && buffer != '\n'){
printf(" <li>");
}
if (buffer == '\n'){
charger++;
if (charger == 2){
phase++;
if (phase == 1){
printf("<ul>");
} else {
printf("</ul>\n");
printf("\n<canvas id='%s1' style='height: 0px; width: 0px;'></canvas>\n<canvas id='%s2' style='height: 0px; width: 0px;'></canvas>\n", str, str);
phase = 0;
header = 1;
scanf("%s", str);
charger = 0;
}
}
} else {
charger = 0;
}
printf("%c", buffer);
}
}