This commit is contained in:
Bohdan Kapliuk 2024-10-27 22:44:13 +02:00
parent d723f30ad8
commit 8e17d44983

View File

@ -27,18 +27,21 @@ int main() {
else if (stack[x-1] == '<') expected = '>';
if (vstup[j] != expected) {
if(expected != '\0'){
printf("Crossed bracket %c in %d, expected %c\n", vstup[j], j, expected);
return 0;
}
else{
printf("Unexpected closing bracket %c in %d\n", vstup[j], position[x-1]);
return 0;
}
}
x--;
expected = '\0';
break;
}
}
}
if (x > 0) {
printf("Unexpected closing bracket %c in %d\n", stack[x-1], position[x-1]);
} else {
printf("All brackets OK\n");
}
printf("All brackets OK\n");
return 0;
}