#C3244. Longest Substring Without Repeating Characters

    ID: 46650 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring that does not contain any repeating characters. In other words, if you denote the substring by sub, then every character in sub must be unique.

For example, given s = "abcabcbb", the answer is 3 because the longest substring without repeating characters is "abc".

Formally, if you let \(f(s)\) be the length of the longest substring of \(s\) with all distinct characters, your task is to compute \(f(s)\) given the string \(s\). The string length \(|s|\) can be large, so your solution must be efficient.

inputFormat

The input is given from stdin as a single line containing the string s.

It is guaranteed that the string contains only printable ASCII characters.

outputFormat

Output the length of the longest substring without repeating characters to stdout as an integer.

## sample
abcabcbb
3