#include <stdio.h>
#include <string.h>
int stack[100];
int top = -1;
void push(int x){
stack[++top] = x;
}
int pop(){
return stack[top--];
}
int main(){
char list[] = "()[{}]()";
for (int i = 0;i < strlen(list); i++){
if (list[i] == '(' || list[i] == '[' || list[i] == '{'){
push(list[i]);
}
else if (list[i] == ')' || list[i] == ']' || list[i] == '}'){
if (top == -1) {
printf("오류");
}
pop();
}
}
printf("정상");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: