#include <stdio.h>
#include <string.h>

char stack[100];
int top = -1;

void push(char x){
    stack[++top] = x;
}

char pop(){
    return stack[top--];
}

int main(){
    char list[] = "{[(])}";

    for (int i = 0; i < strlen(list); i++){
        char c = list[i];

        if (c == '(' || c == '{' || c == '['){
            push(c);
        }
        else if (c == ')' || c == '}' || c == ']'){
            if (top == -1){
                printf("실패\n");
                return 0;
            }
            pop();
        }
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: