🎉 Initial commit
This commit is contained in:
commit
74e99cf19a
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
|
||||
a.out
|
1
file.json
Normal file
1
file.json
Normal file
@ -0,0 +1 @@
|
||||
[{"name":"France","capital":"Paris","population":67364357,"area":551695,"currency":"Euro","languages":["French"],"region":"Europe","subregion":"Western Europe","flag":"https://upload.wikimedia.org/wikipedia/commons/c/c3/Flag_of_France.svg"},{"name":"Germany","capital":"Berlin","population":83240525,"area":357022,"currency":"Euro","languages":["German"],"region":"Europe","subregion":"Western Europe","flag":"https://upload.wikimedia.org/wikipedia/commons/b/ba/Flag_of_Germany.svg"},{"name":"United States","capital":"Washington, D.C.","population":331893745,"area":9833517,"currency":"USD","languages":["English"],"region":"Americas","subregion":"Northern America","flag":"https://upload.wikimedia.org/wikipedia/commons/a/a4/Flag_of_the_United_States.svg"},{"name":"Belgium","capital":"Brussels","population":11589623,"area":30528,"currency":"Euro","languages":["Flemish","French","German"],"region":"Europe","subregion":"Western Europe","flag":"https://upload.wikimedia.org/wikipedia/commons/6/65/Flag_of_Belgium.svg"}]
|
24
main.c
Normal file
24
main.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int main() {
|
||||
int scope = 0;
|
||||
bool in_string = false;
|
||||
bool escape_next = false;
|
||||
|
||||
char c;
|
||||
while (read(STDIN_FILENO, &c, 1) > 0) {
|
||||
putchar(c);
|
||||
|
||||
if (c == '{' || c == '[') {
|
||||
scope++;
|
||||
putchar('\n');
|
||||
}
|
||||
else if (c == '}' || c == ']') {
|
||||
scope--;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user