---
# System prepended metadata

title: 13633 - Indentation
tags: [input]

---

# 13633 - Indentation
>author: Utin
###### tags: `input`

---

## Brief
See the code below

## Solution 0

```c=
#include<stdio.h>

int main() {
    char c, pre_c = '\n';
    int k = 0, header = 0, h=0; //k==0 means 開頭的分號，header==0 means 標頭檔那幾行
    while((c=getchar()) != EOF) {
        if(c == ';' && k == 0) printf(" ");
        else if(c == '\n') {
            if(header != 0 && pre_c != '{' && pre_c != '}') printf(";");
            if(pre_c == '}' && h%2 == 0) printf(";");
            h = 0;
            putchar(c);
            k = 0;
        }
        else if(c != '#' && header == 0 && pre_c == '\n') {
            k = 1;
            putchar(c);
            header = 1;
        }
        else {
            if(c == '{' || c == '}') h += 1;
            k = 1;
            putchar(c);
        }
        pre_c = c;
    }
}

// By Utin
```

## Reference