PythiloMedium · 25 min · Task 10 of 20 · progress kept in this browser

Longest run with no repeats

Find the length of the longest stretch of consecutive characters in which no character appears twice.

longest_unique_run("abbacdeb")  # 5
longest_unique_run("aaaa")      # 1

In the first example, bacde and acdeb both have length 5.

Your task

Write longest_unique_run(text) returning the length of the longest substring with no repeated character.