Problems/

Longest Substring Without Repeating Characters

medium

Given a string s, find the length of the longest substring (contiguous!) that contains no repeated characters.

Example 1

Input: s = "abcabcbb"
Output: 3
Explanation: "abc" has length 3.

Example 2

Input: s = "bbbbb"
Output: 1

Example 3

Input: s = "pwwkew"
Output: 3
Explanation: "wke" — note "pwke" is a subsequence, not a substring.

Constraints

  • 0 <= s.length <= 50000
  • s consists of printable ASCII characters.

Input

s = "abcabcbb"

Expected

3

6 hidden tests run on submit