40: Longest substring without repeating

Given a string, find the length of the longest substring without repeating characters

 

Example 1

Input: abccoded

Output: 4

Explanation: code is the the longest substring without repeating characters

Example 2

Input: aaa

Output: 1