#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] == '('){
push('(');
}
else if(list[i] == ')'){
if (top == -1) {
printf("오류");
return 0;
}
pop();
}
}
printf("정상");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: