This commit is contained in:
Oleksandr Hryshchenko 2021-11-29 19:23:49 +00:00
parent 48284dcb27
commit 91186921dd

View File

@ -27,7 +27,7 @@ int main(){
int x = 0; int x = 0;
//scanf("%[^\n]", string); scanf("%[^\n]", string);
strcpy(BB, string); strcpy(BB, string);
int i = 0; int i = 0;
@ -36,13 +36,24 @@ int main(){
if( BB[i] != '[' || BB[i] != '(' || BB[i] != '{' || BB[i] != '<'){ if( BB[i] != '[' || BB[i] != '(' || BB[i] != '{' || BB[i] != '<'){
}
else {
pushStack(&stack, BB[i]); pushStack(&stack, BB[i]);
BB[i] = ' '; BB[i] = ' ';
x++; x++;
} }
if( BB[i] == ']' || BB[i] == ')' || BB[i] == '}' || BB[i] == '>'){ if( BB[i] != ']' || BB[i] != ')' || BB[i] != '}' || BB[i] != '>'){
if (x == 0){
}
else {
if (x != 0){
}
else {
printf ("Read: %s\nUnexpected closing bracket %c in %d\n",string, BB[i], i); printf ("Read: %s\nUnexpected closing bracket %c in %d\n",string, BB[i], i);
return 0; return 0;
} }