From ad38d800334e62712e5d2f193fbd8745472c39ca Mon Sep 17 00:00:00 2001
From: Florian Burgener <florian.burgener@hesge.ch>
Date: Tue, 7 Dec 2021 14:24:25 +0100
Subject: [PATCH] Validation exercice 1

---
 ex1/main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/ex1/main.c b/ex1/main.c
index ec29406..ef3b5de 100644
--- a/ex1/main.c
+++ b/ex1/main.c
@@ -1,6 +1,6 @@
 /**
  * @file main.c
- * @author Prénom Nom
+ * @author Florian Burgener
  * @brief Exercice 1
  * @version 1.0
  * @date 2021-12-07
@@ -9,31 +9,32 @@
  * 
  */
 
-#include <math.h>
-#include <stdbool.h>
+#include <ctype.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 
 int main() {
-    char str1[100];
-    char str2[100];
+    // 80 characters + 1 (null character).
+    char str1[81];
+    char str2[81];
 
     scanf("%s", str1);
     scanf("%s", str2);
+    printf("%s\n", str1);
 
     if (strlen(str1) != strlen(str2)) {
+        // Strings do not have the same length.
         printf("\ndistance: -1\n");
         return EXIT_FAILURE;
     }
 
     int32_t distance = 0;
-
+    
+    // Calculation of the distance.
     for (int32_t i = 0; i < (int32_t)strlen(str1); i += 1) {
         distance += abs(toupper(str1[i]) - toupper(str2[i]));
-        
     }
 
     printf("\ndistance: %d\n", distance);
-- 
GitLab