Advent of code

 6 décembre 2022 

  Turning Trouble : Trouver premier bout sans répétition
cbhbmmqnmmqvqfqgqcqmmtvvvdsvsc
  1. code.py
input = "cbhbm...vcfnrs"

def findFirstNoReapeatInNChars(txt, n):
    for i in range(len(txt)-n+1):
        s = set(txt[i:i+n])
        if len(s) == n:
            return i+n

print("Réponse partie 1:", findFirstNoReapeatInNChars(input, 4))
print("Réponse partie 2:", findFirstNoReapeatInNChars(input, 14))