From c7050ddf706a2dca8be83669825c955551a43eb1 Mon Sep 17 00:00:00 2001 From: Marat Izmailov Date: Thu, 24 Oct 2024 10:26:00 +0000 Subject: [PATCH] Update a1/program.c --- a1/program.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index d8e6e19..0da835f 100644 --- a/a1/program.c +++ b/a1/program.c @@ -32,10 +32,12 @@ int isMatchingPair(char open, char close) { int main() { char code[MAX_LEN]; - printf("Enter the code: "); fgets(code, MAX_LEN, stdin); - printf("Read: %s", code); + // Убираем лишний символ новой строки, если он есть + code[strcspn(code, "\n")] = 0; + + printf("Read: %s\n", code); for (int i = 0; i < strlen(code); i++) { char c = code[i];