88. Longest Substring Without Repeats
Challenge1000 ms256 MBSolved by 0%
Read one line and print the length of the longest run of consecutive characters in it that contains no repeats.
In abcabcbb the best run is abc, so the answer is 3. In bbbbb it is b, so the
answer is 1.
The comparison is case-sensitive, and spaces count as characters.
Constraints - The line has between 1 and 100000 characters. - Printable ASCII only.
Input
A single line of text.
Output
Print one integer — the length of the longest run with no repeated character.
Inputabcabcbb
Output3
Noteis the worked example from the statement
Inputbbbbb
Output1
Noteis one repeated character, so the answer is 1 rather than 0
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution