From 212c9690a2b020a9c21bb792e525a182133de9c3 Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 18:49:15 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cv10/program.c b/cv10/program.c index 450028f..848f7ba 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -20,7 +20,11 @@ int main() { } i = 0; - while (i < count && scanf("%s", buffer) == 1) { + while (i < count && fgets(buffer, sizeof(buffer), stdin)) { + int len = strlen(buffer); + if (buffer[len - 1] == '\n') { // Remove newline character if present + buffer[len - 1] = '\0'; + } int found = 0; for (j = 0; j < i; j++) { if (strcmp(applications[j], buffer) == 0) {