Longest Substring without Repeating Characters

Find the length of the longest substring of a given string without repeating characters.

Input: abccabcabcc

Output: 3

Explanation: The longest substrings are abc and cab, both of length 3.

Input: aaaabaaa

Output: 2

Explanation: ab is the longest substring, with a length of 2.

Try it yourself