diff --git a/fill.py b/fill.py
index 7af86c09e5089507ed36b716ae70a5ed2b87b23c..b2b56284fad4cb2d999a494558b5d2266409b593 100755
--- a/fill.py
+++ b/fill.py
@@ -6,6 +6,7 @@ nbListes = len(listes)-1
 with open('results.txt','r') as data:
     o = open('results_out.txt','w')
     for line in data.readlines():
+        maxColumn = int(max(line))
         for column in range(1,10):
             first = True
             found = False
@@ -17,7 +18,7 @@ with open('results.txt','r') as data:
                 o.write(listes[ind+1])
                 first = False
                 found = True
-            if found and column < nbListes:
+            if found and column < maxColumn:
                 o.write(" > ")
         o.write("\n")
     o.close()