recursive one-liner for day 6:

with open("input") as f: print( (recursion := lambda line, i, size: i+size if all([line[i:i+size].count(c)==1 for c in line[i:i+size]]) else recursion(line, i+1, size))(f.readline(), 0, 4) )

sorry

Iterative one-liner:

with open("input") as f: print( (lambda line, size: min([i+size if all([line[i:i+size].count(c)==1 for c in line[i:i+size]]) else len(line) for i in range(len(line))]))(f.readline(), 4) )

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.