From 1edb88f9a7fd16742f21b95f46d6384120ed44b4 Mon Sep 17 00:00:00 2001 From: Marat Izmailov Date: Thu, 24 Oct 2024 12:53:39 +0000 Subject: [PATCH] Update a1/program.c --- a1/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index 607b47f..df4174f 100644 --- a/a1/program.c +++ b/a1/program.c @@ -46,14 +46,14 @@ int main() { // Если стек пустой, это ошибка if (top == -1) { printf("Read: %s\n", input); - printf("Unexpected closing bracket %c in %d\n", current, position); + printf("Unexpected closing bracket %c in %d\n", current, position - 1); // Изменено на position - 1 return 1; } // Если скобки не совпадают, это ошибка if (!isMatching(stack[top--], current)) { printf("Read: %s\n", input); - printf("Crossed bracket %c in %d, expected %c.\n", current, position, + printf("Crossed bracket %c in %d, expected %c.\n", current, position - 1, (current == '}') ? '{' : (current == ']') ? '[' : (current == ')') ? '(' : '<'); return 1;