#K2486. Longest Substring Without Repeating Characters

    ID: 24747 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s consisting only of lowercase English letters, your task is to find the length of the longest contiguous substring that contains no repeated characters.

For example, if s = "abcabcbb", the answer is 3 because "abc" is the longest substring without repeating characters. The goal is to achieve an efficient solution, ideally with a time complexity of \(O(n)\), where \(n\) is the length of the string.

Hint: Consider using the sliding window technique to maintain the current substring without repeats.

inputFormat

The input is provided via stdin and consists of a single line containing the string s.

Constraints: \(0 \leq |s| \leq 10^5\) and \(s\) contains only lowercase English letters.

outputFormat

Output a single integer to stdout which is the length of the longest substring of s that does not contain any repeating characters.

## sample
abcabcbb
3