Problem statement
Given a string, find the longest stretch of neighbouring letters with no letter repeated inside it. The stretch is contiguous, so the answer is a window.
A single letter is always a valid stretch, so the answer is at least 1 whenever the string is not empty.
Examples
Input"abcabcbb"
Output3
The stretch abc repeats nothing, and the next a would repeat the first one.
Input"bbbbb"
Output1
Every window longer than one letter holds two copies of b.
The walkthrough is part of Premium
The statement and the examples above stay free. The full how-to-solve walkthrough, the cost notes in plain words and the interactive step-by-step visualizer unlock with a Premium plan.
See pricing